根据月份判断季节

来源:互联网 发布:淘宝批发网叫什么 编辑:程序博客网 时间:2024/05/15 03:37
package test;import java.util.Scanner;public class JudgeMonth {public static void main(String[] args){Scanner scanner=new Scanner(System.in);System.out.println("请输入你想查询的月份:");int month=scanner.nextInt();switch (month) {case 12:case 1:case 2: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("你那有这个月份吗?");break;}}}-----------------------------------------------------------------------------------------------------------请输入你想查询的月份:12冬季

0 0