if控制语句
public static void main(String[] args) {
/*** if控制语句* 列举学生成绩,*/int crose = 86;//满分100//成绩在90~100if(crose>90){System.out.println("优秀");}else //成绩在75~90if(crose>=75){System.out.println("良好");}else //成绩在60~75if(crose>=60){System.out.println("及格");}else{//60分以下System.out.println("不及格");}
}
输出结果:良好
switch控制语句
public static void main(String[] args) {
/*** switch控制语句* 这个语句方便写对应条件的语句,比如一年之中有四个季节,12个月,三个月对应一个季节*/int month = 6;switch(month){case 12:System.out.println("冬天");break;case 1:System.out.println("冬天");break;case 2:System.out.println("冬天");break;case 3:System.out.println("春天");break;case 4:System.out.println("春天");break;case 5:System.out.println("春天");break;case 6: