1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
import java.util.Scanner;
public class A04 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
System.out.print( "请输入数字1~7(输入0结束):" );
int choice = input.nextInt();
String show = "" ;
while (choice != 0 ) {
switch (choice) {
case 1 :
show = "今天 是Mon" ;
break ;
case 2 :
show = "今天 是Tue" ;
break ;
case 3 :
show = "今天 是Wed" ;
break ;
case 4 :
show = "今天 是Thu" ;
break ;
case 5 :
show = "今天 是Fri" ;
break ;
case 6 :
show = "今天 是Sat" ;
break ;
case 7 :
show = "今天 是Sun" ;
break ;
default :
System.out.println( "程序错误" );
return ;
}
System.out.println(show);
System.out.print( "请输入数字1~7(输入0结束):" );
choice = input.nextInt();
}
System.out.println( "程序结束!" );
}
|
本文转自 Y幕徐 51CTO博客,原文链接:http://blog.51cto.com/765133133/1420497