public class Main
{
public static void main(String[] args)
{
isLeapYear(1600);
}
public static boolean isLeapYear(int year)
{
if (year < 1 || year > 9999) return false;
if (year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
return true;
}
else return false;
}
}
为什么会发生这种情况?当我运行代码时没有显示任何输出。
最佳答案
没有显示输出,因为您没有显示任何内容,要显示输出,请尝试以下操作:
public static void main(String[] args)
{
System.out.println(isLeapYear(1600));
}
关于java - Main.isLeapYear 的结果被忽略 - 为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50852608/