A
Q. What is the output of the following code?
Code:
int x = 5;
switch (x) {
case 1:
System.out.println(“x is 1”);
break;
case 5:
System.out.println(“x is 5”);
break;
default:
System.out.println(“x is not 1 or 5”);
}
switch (x) {
case 1:
System.out.println(“x is 1”);
break;
case 5:
System.out.println(“x is 5”);
break;
default:
System.out.println(“x is not 1 or 5”);
}
- Correct Answer - Option(B)
- Views: 15
- Filed under category Java
- Hashtags:
Discusssion
Login to discuss.