CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Labeled Break Escapes Both Loops

Java code walkthrough · Question 50
hardLoops

Code

Read carefully. What does this print?
1public class Main {
2 public static void main(String[] args) {
3 int count = 0;
4 outer:
5 for (int i = 1; i <= 3; i++) {
6 for (int j = 1; j <= 3; j++) {
7 if (i * j >= 4) {
8 break outer;
9 }
10 count++;
11 System.out.println(i + "," + j);
12 }
13 }
14 System.out.println("count=" + count);
15 }
16}

Your answer