输入数字查看对应的星期 java

导入包Scanner包

 System.out.print("请输入星期一到星期七一个整数(1-7):");
         int week =input.nextInt();
         if (week==1){
             System.out.println("星期1");
         }else if (week==2){
             System.out.println("星期2");
         }else if (week==3){
             System.out.println("星期3");
         }else if (week==4){
             System.out.println("星期4");
         }else if (week==5){
             System.out.println("星期5");
         }else if (week==6){
             System.out.println("星期6");
         }else if (week==7){
             System.out.println("星期7");
         }else if (week>7 |week<1){
                System.out.println("输入正确的星期");
         }

            System.out.println("结束");

你可能感兴趣的:(java,开发语言)