< Java Programming < Keywords
break
is a Java keyword.
Jumps (breaks) out from a loop. Also used at switch
statement.
For example:
![]() |
for ( int i=0; i < maxLoopIter; i++ ) {
System.out.println("Iter=" +i);
if ( i == 5 ) {
break; // -- 5 iteration is enough --
}
}
|
See also:
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.