编辑代码

package rj2201;

import java.util.Scanner;

public class Test_ifelseif {
    public static void main(String[] args) {
        System.out.println("请输入1到12之间的一个整数代表月份:");
        Scanner sc=new Scanner(System.in);
        int m=sc.nextInt();
        if(m>=11&&m<=12||m==1)
            System.out.println("冬天");
        else if(m>=2&&m<5)
            System.out.println("春天");
        else if(m>=5&&m<8)
            System.out.println("夏天");
        else if(m>=8&&m<11)
            System.out.println("秋天");
        else
            System.out.println("您输入有误!");
    }
}