0
About switch this concept
public class Program { public static void main(String[] args) { int day = 1; switch(day) { case 1: System.out.println("Monday"); case 2: System.out.println("Tuesday"); case 3: System.out.println("Wednesday"); } } } for this program the output is Monday Tuesday Wednesday How is it possible?
4 Answers
+ 10
Since there is no break statement along with the case stmt ,therefore fall through happens.
+ 7
Because there is no break
+ 6
Dont know much about java... But you need to add breaks after every case
Check out the SL java course for more