题目:
输出代码:
public class demo02 {
//这是一个main方法,程序的入口
public static void main(String[] args) {
//键盘输入
Scanner input =new Scanner(System.in);
int num=-1;
//判断
while (num!=0){
System.out.print("请输入数字1-7输入0结束:");
num= input.nextInt();
switch (num){
case 1:
System.out.println("今天是 MON");
break;
case 2:
System.out.println("今天是 TUE");
break;
case 3:
System.out.println("今天是 WED");
break;
case 4:
System.out.println("今天是 THU");
break;
case 5:
System.out.println("今天是 FRI");
break;
case 6:
System.out.println("今天是 SAT");
break;
case 7:
System.out.println("今天是 SUN");
break;
case 0:
break;
default:
System.out.println("请重新输入");
break;
}
}
System.out.println("程序结束!");
}
}
输出结果: