java春夏秋冬(switch)简易版

import java.util.Scanner;
public class pdjj03 {
public static void main(String[] args) {
System.out.println("程序开始");
Scanner sc = new Scanner(System.in);
System.out.println("请输入月份");
int jj = sc.nextInt();
switch (jj){
case 1:
case 2:
case 12:
System.out.println("这是冬季");
break;
case 3:
case 4:
case 5:
System.out.println("这是春季");
break;
case 6:
case 7:
case 8:
System.out.println("这是夏季");
break;
case 9:
case 10:
case 11:
System.out.println("这是秋季");
break;
default:
System.out.println("输入的月份有误,请重新输入");
}
System.out.println("结束");
}
}

你可能感兴趣的:(java,开发语言)