wangyinxu

if语句--java


class IfTest{
     public static void main(String args[]){
           int month;
        if(month<1 ||month>12){
               System.out.println("没有对应月季");
}else if(month=<5 && month>=3){
                  System.out.println(month+"月是春季");
}else if(month<=8 && month>=6){
                   System.out.println(month+"月是夏季");
}else if(month<=11 && month>=9){
                   System.out.println(month+"月是秋季");
}else{
                  System.out.println(month+"月是冬季");
}
}
}

 

public void day(int x){
          if(x==1){
             System.out.println("星期一");
}else if(x==2){
              System.out.println("星期二");               
} else if(x==3){
              System.out.println("星期三");               
} else if(x==4){
              System.out.println("星期四");               
} else if(x==5){
              System.out.println("星期五");               
} else if(x==6){
              System.out.println("星期六");               
} else if(x==7){
              System.out.println("星期日");               
} else{
              System.out.println("输入错误,只能输入1~7整数");
}
}
}

 

发表于 2017-03-03 14:50  跳动de手指  阅读(208)  评论(0编辑  收藏  举报
 

分类:

技术点:

相关文章:

  • 2021-11-29
  • 2021-11-29
  • 2021-12-22
  • 2021-11-20
  • 2021-09-28
  • 2021-05-08
  • 2021-08-15
  • 2021-11-29
猜你喜欢
  • 2021-12-21
  • 2021-12-23
  • 2021-09-27
  • 2021-10-02
  • 2022-02-15
  • 2022-01-23
  • 2021-11-29
相关资源
相似解决方案