1
2public class SwitchDemo {
3 public static void main(String[] args) {
4
5 int month = 8;
6 String monthString;
7 switch (month) {
8 case 1: monthString = "January";
9 break;
10 case 2: monthString = "February";
11 break;
12 case 3: monthString = "March";
13 break;
14 case 4: monthString = "April";
15 break;
16 case 5: monthString = "May";
17 break;
18 case 6: monthString = "June";
19 break;
20 case 7: monthString = "July";
21 break;
22 case 8: monthString = "August";
23 break;
24 case 9: monthString = "September";
25 break;
26 case 10: monthString = "October";
27 break;
28 case 11: monthString = "November";
29 break;
30 case 12: monthString = "December";
31 break;
32 default: monthString = "Invalid month";
33 break;
34 }
35 System.out.println(monthString);
36 }
37}
38