What is the result of the following program execution?

public class Bar {
    public static void main(String args[]) {
    label:
        for (int i = 0; i < 5; ++i) {
            for (int j = 0; j < 5; ++j) {
                if (i > 2) break label;
                System.out.print(j);
            }
            System.out.print(" ");
        }
    }
}
Explanation
Break operator with the label allows you to bypass an identified block of code. The program will display a line 01234 01234 01234, and then will quit all cycles and continue the execution.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes