0
what is the output of the following code below ?
int a = 11; int b = 12; int c = 40; switch (a) { case 40 : System.out.println(b); break; default : System.out.println(c); } plz help me answer the question above...thnks
2 Answers
+ 11
Hello !!
Here the 40 would be printed as you are checking variable 'a' for a single case of 40. The value of 'a' is 11 so case 40 is false and the last default block is executed and value of variable 'c' is printed i.e. 40.
Hope This Helps !!!
0
40