Menu
Question Index
...

What will be the output of the program?

class Output
{
    final static short i = 2;
    public static int j = 0;
    
    public static void main(String [] args)
    {
        for (int k = 0; k < 3; k++)
        {
            switch (k)
            {
                case i : System.out.print(" 1 ");
                case i - 1 : System.out.print(" 2 ");
                default : System.out.print(" 0 ");
            }
        }
    }
}


0 1 2
0 1 2 0 2 0
2 1 0 1 0 0
0 2 0 1 2 0
Compilation Error

Doubts

Problems

Topic: Static Keyword In Java final Keyword In Java

Read this topic Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App