Determine If a Year Is a Leap Year in Java
Description
The following code shows how to determine If a Year Is a Leap Year.
Example
/*w w w . jav a 2 s . c o m*/
import java.util.GregorianCalendar;
public class Main {
public static void main(String[] argv) throws Exception {
GregorianCalendar cal = new GregorianCalendar();
boolean b = cal.isLeapYear(1998); // false
b = cal.isLeapYear(2000); // true
b = cal.isLeapYear(0); // true
}
}