public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
try {
int num = sc.nextInt();
switch (num) {
case 0:
System.exit(0);
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;
}
default:
System.out.println("输入错误");
}
} catch (InputMismatchException e) {
System.out.print("请输入数字");
}
}
大概写了一下