Java   View all facts   Glossary   Help
syntactic unit > statement > control flow statement > break statement
Next control flow statementcontinue statement    Upcontrol flow statement    Previous control flow statementreturn statement   

break statement comparison table
Subject have example jump
labelled break statement
//Without the label the break statement would exit the inner loop and resume execution with the outer loop
out:
for (int i = 0; i < 10; i++) {
while (x < 50) {
if (i * x++ > 400) {
break out;
}
//inner loop here
}
//outer loop here
}
 
unlabelled break statement
//Without a label the break statement exits the inner loop and resumes execution with the outer loop
for (int i = 0; i < 10; i++) {
while (x < 50) {
if (i * x++ > 400) {
break;
}
//inner loop here
}
//outer loop here
}
outside the nearest loop to an enclosing loop or to the next statement outside the loop

Next control flow statementcontinue statement    Upcontrol flow statement    Previous control flow statementreturn statement