break
Statement
break
, continue
, and return
.
These three statements transfer control to other part of the program.
The break
statement can be used to “jump out” of a loop statement.
This example jumps out of the loop when i is equal to 4.
In Java, break is majorly used for:
|
|
|
|
|