Given this code inside a method:
public class Main { public static void main(String[] args) { int count = 0; outer: for (int x = 0; x < 5; x++) { middle: for (int y = 0; y < 5; y++) { if (y == 1) continue middle; if (y == 3) break middle; count++;//from w w w . j a va 2 s . c om } if (x > 2) continue outer; count = count + 10; } System.out.println("count: " + count); } }
What is the result?
B is correct.
The label, break, and continue statements are all legal.
A continue statement ends the current iteration of a loop, a break statement ends all iterations of a loop.