zoukankan      html  css  js  c++  java
  • 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整数");
    }
    }
    }
  • 相关阅读:
    UVA 11995
    LA 5031
    防卫导弹
    跳马问题
    UVA 11992
    POJ 3264 Balanced Lineup
    0-1背包
    石子合并
    小技巧
    Android广播中有序和无序的区别
  • 原文地址:https://www.cnblogs.com/wangyinxu/p/6496658.html
Copyright © 2011-2022 走看看