//导包
import java.util.Scanner;
public class IfDemo {
public static void main(String[] args) {
//创建对象
Scanner s = new Scanner(System.in);
//需求2:键盘录入一个星期数(1~7),输入对应的星期几;
System.out.println("请输入一个星期数(1~7):");
int week = s.nextInt();
if (week == 1) {
System.out.println("星期一");
} else if (week == 2) {
System.out.println("星期二");
} else if (week == 3) {
System.out.println("星期三");
} else if (week == 4) {
System.out.println("星期四");
} else if (week == 5) {
System.out.println("星期五");
} else if (week == 6) {
System.out.println("星期六");
} else if (week == 7) {
System.out.println("星期日");
} else {
System.out.println("请重新输入数字(1~7)");
}
}
}
10-22
1342
11-13
657
11-08
235