What will be the result of the program?

public class MyTest {
    public static void main(String[] args) {        
        label1: for (int i = 0; i < 3; i++) {
            if (i == 1)
                continue label1; 
            label2:
                System.out.print("TEST ");
            label3:;
        }
    }
}
Explanation
The construction continue label1: transfers control to the label and the cycle will be continued.
If instead of continue put break - TEST will be printed once.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback