版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。版权
java循环专栏收录该内容
13 篇文章0 订阅
订阅专栏
//需要输入,须先声明扫描器import java.util.Scanner;
public class S {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int num = 0;
String day = “”;
System.out.print(“请输入1~7的整数(输入0结束):”);
num = input.nextInt();
do{
switch (num) {
case 1:
day = “今天是MON”;
System.out.println(day);
break;
case 2:
day = “今天是TUE”;
System.out.println(day);
break;
case 3:
day = “今天是WED”;
System.out.println(day);
break;
case 4:
day = “今天是THU”;
System.out.println(day);
break;
case 5:
day = “今天是FRI”;
System.out.println(day);
break;
case 6:
day = “今天是SAT”;
System.out.println(day);
break;
case 7:
day = “今天是SUN”;
System.out.println(day);
break;
default:
System.out.println(“输入错误!请重新输入!”);
break;
}
System.out.print(“请输入1~7的整数(输入0结束):”);
num = input.nextInt();
}while(num!=0);<