Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Flow Control Questions
Java switch with constant vs non-constant case labels and fall-through: what happens here? public class Switch2 { final static short x = 2; public static int y = 0; // not constant expression public static void main(String [] args) { for (int z = 0; z < 3; z++) { switch (z) { case y: System.out.print("0 "); // Line 11 case x - 1: System.out.print("1 "); // Line 12 case x: System.out.print("2 "); // Line 13 } } } }
1
2