判断一个年份是否是闰年
public class Test {
public static boolean isLeapYear(int year) {
if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
return true;
}
return false;
}
public static void main(String[] args) {
if (isLeapYear(2007)) {
System.out.println("是闰年");
}
else {
System.out.println("不是闰年");
}
}
}