Menu
Question Index
...

What will be the output of the following program?

public class DemoOnSwitchCase
{
    public static void main(String args[])
    {
        int variable = 7;
        switch (variable++)
        {
            case 7 :
                switch (variable--)
                {
                    default :
                        System.out.print(variable);
                    case 7 :
                }
            default :
                System.out.print("wonders");
        }
    }
}


7wonders
wonders7
wonders
6
Compilation Error or Runtime Error

Doubts

Problems

Topic: Nested switch Statements 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