import java.util.Scanner; public class Sun9 { public static void main(String[] args){ Scanner in =new Scanner(System.in); System.out.print("请输入年份:"); int year =in.nextInt(); System.out.print("请输入月份:"); int mouth = in.nextInt(); System.out.print("请输入几号:"); int day = in.nextInt(); int maxday=0; for(int i=1;i<mouth;i++){ switch(i){ case 1: case 3: case 5: case 7: case 8: case 10: case 12: maxday+=31; break; case 4: case 6: case 9: case 11: maxday+=30; break; case 2: maxday+=28; break; default: System.out.println("输入月份错误!"); } } if((mouth)>2&&((year%4==0)&&year%100!=0)||(year%400==0)){ maxday++; } maxday+=day; System.out.println("此天是第:"+maxday+"天"); } } 输入后别的都正确 但当输入某年 13月 几号时 月份没有报错 是哪里有问题? 里面该怎么办?希望尽快回答!~