1 public class Example {
2
3
4 public static void main(String[] args) {
5 // TODO 自动生成的方法存根
6
7 int x = 1;
8 switch(x){
9 case 1:
10 System.out.println("今天是 星期一 Monday");
11 break;
12 case 2:
13 System.out.println("今天是 星期二 Tuesday");
14 break;
15
16 case 3:
17 System.out.println("今天是 星期三 Wednesday");
18 break;
19 case 4:
20 System.out.println("今天是 星期四 Thursday");
21 break;
22 case 5:
23 System.out.println("今天是 星期五 Friday");
24 break;
25 case 6:
26 System.out.println("今天是 星期六 Saturday");
27 break;
28 case 7:
29 System.out.println("今天是 星期七 Sunday");
30 break;
31 default:
32 System.out.println("都不匹配 I don't know");
33 break;
34 }
35
36
37 int y = 40;
38 switch (y){
39 case 20:
40 System.out.println("弱冠弄柔翰,卓荦观群书。");
41 break;
42 case 30:
43 System.out.println("吾十有五而志于学,三十而立。");
44 break;
45 case 40:
46 System.out.println("四十曰强而仕。");
47 System.out.println("不惑之年。");
48 break;
49 case 50:
50 System.out.println("五十而知天命。");
51 break;
52 case 60:
53 System.out.println("六十而耳顺。");
54 break;
55 case 70:
56 System.out.println("酒债寻常行处有,人生七十古来稀。");
57 break;
58 case 80:
59 case 90:
60 System.out.println("八十、九十曰耄");
61 break;
62 case 100:
63 System.out.println("百年曰期,颐。");
64 break;
65 default:
66 System.out.println("I don't know");
67 break;
68 }
69 }
70
71 }