Menu
Question Index
...

What will be the output of the following program?

public class PrintStatment15
{
    public static void main(String args[])
    {
        int variable = 1;
        switch (variable)
        {
            case 1 :
                System.out.print("P");
            case 2 :
            case 3 :
                System.out.print("Q");
            break;
            case 4 :
                System.out.print("R");
            default :
                System.out.print("S");
         }
    }
}


P
S
PQ
PQRS
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