首页 > 编程语言 > 详细

if语句--java

时间:2017-03-03 14:58:42      阅读:247      评论:0      收藏:0      [点我收藏+]

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整数");
}
}
}

 

if语句--java

原文:http://www.cnblogs.com/wangyinxu/p/6496658.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!