Skip to content
Advertisement

Tag: break

Ordered or unordered Sequence problem in java

I am facing problem in solving the question below:- (can someone please help????) Write a program that reads a sequence of integer numbers and outputs true if the sequence is ordered (in ascending or descending order), otherwise, false. Keep in mind, if a number has the same value as the following number, it does not break the order. The sequence

How to break out or exit a method in Java?

The keyword break in Java can be used for breaking out of a loop or switch statement. Is there anything which can be used to break from a method? Answer Use the return keyword to exit from a method. From the Java Tutorial that I linked to above: Any method declared void doesn’t return a value. It does not need

Advertisement