Menu
Question Index
...

What will be the output of the following program?

public class TestSwitch
{
    public static void main(String a[])
    {
        char ch = 'a';
        switch (ch)
        {
            case 'a' :
            case 'A' :
                System.out.print(ch);
                break;
            case 'b' :
            case 'B' :
                System.out.print(ch);
                break;
            case 'c' :
            case 'C' :
                System.out.print(ch);
                break;
            case 'd' :
            case 'D' :
                System.out.print(ch);
        }
    }
}


abcd
a
aa
ab
Compilation Error or Runtime 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