Java Jump Statements
Java
supports three jump statements: break, continue, and return. These
statements transfer control to another part of your program.
Break:
In java, the break
statement has three uses. First, it terminates a statement sequence in a
switch statement. Second, it can be used to exit a loop. Third, it can
be used as a civilized form of goto.
Continue:
If you want to force an
early iteration of a loop. Then you can use continue statement. In while
and do-while loop's end. The continue statement caused control to be
transferred directly to the conditional expression that controls the
loop. In for loop, control goes first to the iteration portion of the
for statement and then to the conditional expression.
Return:
The return statement is
used to explicitly return from a method. That is, it causes program
control to transfer back to the caller of the method.
Post a Comment