Jump Statement in Java

16 Shares

Jump statement in Java:-

A statement that is used to transfer the control to various part of the loop is called a jump statement.

There are five jump statements in java.
1) Break
2) Continue
3) Goto
4) Return
5) Labelled

Break:- Break is the jump statement use to terminate loop force ling that is used to terminate the loop even the condition is true. It is always used with if statement.

break example

break example 2

Continue:- Continue is the jump statement use to skip the step of the loop. That is used to execute all the states of the loop and some time used the leave one or more statement of a loop. It is always used with if statement.

continue syantax

continue example

continue output

Goto:- It is used to transfer the control randomly to the gram. The implementation is goto has not been providing yet by the java so it can’t be used by the programmer.

Return:- Return is jump statement used to return the control from calling program to any part of the program.

Syntax:-
a) Return:- It will return null or control from the calling program to the caller.
b) Return constant:- It will return the constant data.
c) Return variable:- It will return the value of the variable.
d) Return expression:- It will return the result of the expression.

return loop

 

16 Shares

Leave a Reply