Код: Выделить всё
public class m {
public static void main(String[] args) {
int count = 0;
outerLoop:
for (int i = 0; i < 2; i++) Inner:{
for (int j = 0; j < 10; j++) {
count++;
if (count == 15) {
break Inner;
}
System.out.print("Count: " + count);
}
}
System.out.println("Exited the loops when count reached 15.");
}
}
Код: Выделить всё
Count: 1
Count: 2
Count: 3
Count: 4
Count: 5
Count: 6
Count: 7
Count: 8
Count: 9
Count: 10
Count: 11
Count: 12
Count: 13
Count: 14
Exited the loops when count reached 15.
Я хочу понять, как сломать помеченный работает.
Подробнее здесь: https://stackoverflow.com/questions/790 ... inner-loop