What will be the output of the program?


			  		

Loading

Practice Flow Control –

What will be the output of the program?

int i = l, j = -1;  
switch (i) {
case 0, 1: j = 1; /* Line 3 */
case 2: j = 2;
default: j = 0;
}
System.out.println("j = " + j);

 

switch(x) { 
default:

Loading

Practice Flow Control –

switch(x) { 
default:
System.out.println("Hello");
}

Which two are acceptable types for x?

  1. byte
  2. long
  3. char
  4. float
  5. Short
  6. Long