Menu
Question Index
...

What will be the output of the following program?

public class TwoInOneBook {
    public static void main(String[] args) {
        boolean b = true;
        One : {
            Two : {
                Book : {
                    System.out.println("Book block");
                    break Two;
                }
                System.out.println("Two block");
            }
            System.out.println("One block");
        }
        System.out.println("Main block");
    }
}


Book block
Two block
One block
Main block
Book block
One block
Main block
Compilation Error
Runtime Error

Doubts

Problems

Topic: Using Java Break Statements as Java Goto

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App