```java
public class LeapYear {
public static void main(String[] args) {
for (int i = 1000; i <= 2000; i++) {
if (isLeapYear(i)) {
System.out.println(i + "是闰年");
}
}
}
public static boolean isLeapYear(int year) {
if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
return true;
} else {
return false;
}
}
}
```
public class LeapYear {
public static void main(String[] args) {
for (int i = 1000; i <= 2000; i++) {
if (isLeapYear(i)) {
System.out.println(i + "是闰年");
}
}
}
public static boolean isLeapYear(int year) {
if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
return true;
} else {
return false;
}
}
}
```
java定义方法判断闰年,在主函数里调用求1000~2000的闰年
```javapublic class LeapYear { public static void main(String[] args) { for (int i = 1000; i <= 2000; i++) { if (isLeapYear(i)) { 。下面小编给大家分享java定义方法判断闰年,在主函数里调用求1000~2000的闰年,希望能帮助到大家。 java定义方法判断闰年,在主函数里调用求1000~2000的闰年文档下载网址链接:
推荐度:





点击下载文档文档为doc格式