Possible Duplicate:
Why does my program only outputs one result instead five?
/ *
*查找一年是否leap年
* /
public class LeapYear{
public static void year(int leapYear){
System.out.println(leapYear);
}
public static void main (String[] args) {
leapYear(2010);
leapYear(2008);
leapYear(2010);
leapYear(2008);
leapYear(1565);
String result;
if (year % 400 == 0) {
result = "is a leap year.";
} else if (year % 100 == 0) {
result = "is not a leap year.";
} else if (year % 4 == 0) {
result = "is a leap year.";
} else {
result = "is not a leap year.";
}
System.out.println(year + ": " + result);
}
}
为什么所有的jumpYear()都不调用?
最佳答案
您没有定义任何名为jumpYear的函数。
关于java - 谁能告诉我为什么不给我leap年? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7071491/