判断一年是否为闰年
package cn;
public class Test3 {
public static void main(String[] args) {
int i = 1996;
Test3 t = new Test3();
t.leapyear(i);
}
public void leapyear(int n) {
if (n % 4 == 0 && n % 100 != 0) {
System.out.println(n + "年是闰年");
} else if (n % 100 == 0 && n % 400 == 0) {
System.out.println(n + "年是闰年");
} else {
System.out.println(n + "年不是闰年");
}
}
}