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:
|
|
|
|
|
“Learn to light a candle in the darkest moments of someone’s life. Be the light that helps others see; it is what gives life its deepest significance.” ― Roy T. Bennett, The Light in the Heart |