Menu
Question Index
...

What will be the output of the following program.

class HappyNewYear
{
    public static void main(String s[])
    {
        int code = 3;
        
        switch(code)
        {
            case 1:
                System.out.println("Wish");
            case 2:
                System.out.println("You");
            default:
                System.out.println("A");
            case 3:
                System.out.println("Happy");
            case 4:
                System.out.println("New");
            case 5:
                System.out.println("Year");
        }
    }
}


Happy
Happy
New
Year
Wish
You
A
Happy
New
Year
Compilation Error

Doubts

Problems

Topic: switch Statement In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App