/*
* 键盘输入年份和月份,然后控制台返回该月份的天数(闰年2月29天).
* */
public class Demo01 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入年份:");
int year = sc.nextInt();
System.out.println("请输入月份:");
int month = sc.nextInt();
if(month<=0 || month>12){
System.out.println("请输入正确的月份!");
}else if(month==4 || month==6 || month==9 || month==11){
System.out.println(year+"年"+month+"月有:30天");
}else if(month==2){
if(month%4==0 && month%100!=0 || month%400==0){
System.out.println(year+"年"+month+"月有:29天");
}else{
System.out.println(year+"年"+month+"月有:28天");
}
}else{
System.out.println(year+"年"+month+"月有:30天");
}
}
}