Programming Language Java Control Flow Question #2150
Single Choice Not Set

QWhat all gets printed when the following program is compiled and run.
public class Test{
      public static void main(String args[]){ 
            int i, j=1;
            i = (j>1)?2:1;
            switch(i){
                  case 0: System.out.println(0); break;
                  case 1: System.out.println(1);
                  case 2: System.out.println(2); break;
                  case 3: System.out.println(3); break;
            }
      }
}

ID: #2150 Java Control Flow 777 views
Question Info
#2150Q ID
Not SetDifficulty
Java Control FlowTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • B 1
  • C 2
  • D 1 2
Correct Answer

Explanation

1 2

Share This Question

Challenge a friend or share with your study group.