Menu
Question Index
...

What will be the output of the following program?

public class BreakTheGlass {
    public static void main(String[] args) {
        int x = 15;
        x = 10 + x - x + 35;
        switch (x) {
            case 35 :
                System.out.println("Switch 35");
                break;
            case 45 :
                System.out.println("Switch 45");
                break;
            case 55 :
                System.out.println("Switch 55");
                break;
            case 65 :
                System.out.println("Switch 65");
                break;
        }
    }
}


Switch 35
Switch 45
Switch 55
Switch 65
Switch 45
Switch 55
Switch 65
Switch 45
Compilation Error
Runtime Error

Doubts

Problems

Topic: Using break in switch case Statement

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App