Labelled breaks breaks out of several levels of nested loops inside a pair of curly braces.
publicclass Main {
publicstaticvoid main(String args[]) {
int len = 100;
int key = 50;
int k = 0;
out: {
for (int i = 0; i < len; i++) {
for (int j = 0; j < len; j++) {
if (i == key) {
break out;
}
k += 1;
}
}
}
System.out.println(k);
}
}