import java.util.Scanner;
public class Demo03用if语句判断月份的天数 {
public static void main(String[] args) {
int year,month;
Scanner in=new Scanner(System.in);
System.out.println(“请输入您要查询的年份”);
year=in.nextInt();
System.out.println(“请输入您要查询的月份”);
month=in.nextInt();
if(month1||month3||month5||month7||month8||month10||month12) {
System.out.println(year+“年”+month+“月有31天”);
}
else if(month4||month6||month9||month11) {
System.out.println(year+“年”+month+“月有30天”);
}
else if(month2) {
if(year%4000||(year%40&&year%100!=0)) {
System.out.println(year+“年”+month+“月有29天”);
}
else {
System.out.println(year+“年”+month+“月有28天”);
}
}
else {
System.out.println(“您输入的月份不存在”);
}
}
}