首先我们要能从控制台输入数字
Scanner sc = new Scanner(System.in);
System.out.println("请输入当前月份:");
int month = sc.nextInt();
然后用循环语句 if else if else,当然还有其他的循环语句也可以
if(month>2&&month<=4){
System.out.println("春季");
}else if(month>=5&&month<=7){//&&并且
System.out.println("夏季");
}else if (month>=8&&month<=10) {
System.out.println("秋季");
}else if(month==11||month==12||month==1||month==2){
System.out.println("冬季");//
}else {
System.out.println("拜拜");
}
Scanner sc = new Scanner(System.in);
System.out.println("请输入当前月份:");
int month = sc.nextInt();
然后用循环语句 if else if else,当然还有其他的循环语句也可以
if(month>2&&month<=4){
System.out.println("春季");
}else if(month>=5&&month<=7){//&&并且
System.out.println("夏季");
}else if (month>=8&&month<=10) {
System.out.println("秋季");
}else if(month==11||month==12||month==1||month==2){
System.out.println("冬季");//
}else {
System.out.println("拜拜");
}