123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import java.util.Scanner;
- /**
- * ClassName: TestScanner01
- *
- * @Author 爱扣钉-陈晨
- * @Create 2023/11/20 9:14
- * @Version 1.0
- */
- public class TestSwitch04 {
- //根据数字 显示星期
- public static void main(String[] args) {
- //输入数字
- Scanner scanner = new Scanner(System.in);
- System.out.println("请输入正整数数字");
- int i = scanner.nextInt();
- switch (i){
- case 1:
- System.out.println("星期1");
- break;
- case 2:
- System.out.println("星期2");
- break;
- case 3:
- System.out.println("星期3");
- break;
- case 4:
- System.out.println("星期4");
- break;
- case 5:
- System.out.println("星期5");
- break;
- case 6:
- System.out.println("星期6");
- break;
- case 7:
- System.out.println("星期日");
- break;
- default:
- System.out.println("输入的星期不存在!!");
- }
- }
- }
|