Multiple choice technology programming languages

What is the result? class Circus { public static void main(String[] args) { int x = 9; int y = 6; for(int z = 0; z < 6; z++, y--) { if(x > 2) x--; label: if(x > 5) { System.out.print(x + " "); --x; continue label; } x--; } } }

  1. 8

  2. 8 7

  3. An exception is thrown at runtime.

  4. Compilation fails.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In Java, a labeled continue statement can only target a loop structures like for, while, or do-while. Since the label here targets an if conditional block instead of a loop, the code fails compilation with a syntax error.