What is the output of following piece of code ? int x = 2; switch (x) { case 1:System.out.println("1"); case 2: case 3:System.out.println("3"); case 4: case 5:System.out.println("5"); } (a) No output (b) 3 and 5 (c) 1, 3 and 5 (d) 3

(b)

Showing Answers 1 - 5 of 5 Answers

Dinesh

  • Jan 6th, 2006
 

B cause there is no break in the conditions

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions