这可能是一个很大的菜鸟错误,但我不明白为什么我的 IDE 不喜欢我的方法调用。
//main here:
isLeapYear(-1600);
isLeapYear(1600);
isLeapYear(2017);
isLeapYear(2000);
public static boolean isLeapYear(int year){
if(year >= 1 && year <= 9999) {
if (year % 400 == 0) {
System.out.println("true");
return true;
} else if (year % 4 == 0 && year % == !100) {
System.out.println("true");
return true;
} else {
System.out.println("false");
return false;
}
//return false if not in year range
System.out.println("false");
return false;
}
}
}
沧海一幻觉
冉冉说
相关分类