public class MyClass {
public static void main(String args[]) {
outer: for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
if (i + j > 5) {
System.out.println("break");
System.out.println(i + " : " + j);
break outer;
}
System.out.println(i + " : " + j);
}
}
System.out.println("end nested for loop");
}
}
/*
run:
0 : 0
0 : 1
0 : 2
0 : 3
0 : 4
1 : 0
1 : 1
1 : 2
1 : 3
1 : 4
2 : 0
2 : 1
2 : 2
2 : 3
break
2 : 4
end nested for loop
*/