import java.util.Scanner;
public class Jijie {
int s;
public void showC() {
System.out.println();
System.out.println("该季节为春季");
}
public void showX() {
System.out.println();
System.out.println("该季节为夏季");
}
public void showQ() {
System.out.println();
System.out.println("该季节为秋季");
}
public void showD() {
System.out.println();
System.out.println("该季节为冬季");
}
public static void main(String[] args) {
Jijie j = new Jijie();
Scanner input = new Scanner(System.in);
System.out.println("请输入月份:");
j.s = input.nextInt();
switch (j.s) {
case 1:
case 2:
case 3:
j.showC();
break;
case 4:
case 5:
case 6:
j.showX();
break;
case 7:
case 8:
case 9:
j.showQ();
break;
case 10:
case 11:
case 12:
j.showD();
break;
}
}
}
java练习---季节
最新推荐文章于 2022-10-27 14:42:35 发布