GregorianCalendar cal = new GregorianCalendar();
boolean b = cal.isLeapYear(1998); // false
b = cal.isLeapYear(2000); // true
b = cal.isLeapYear(0); // true
class leap
{
public static void main(String[] args)
{
int year=2012;
{
if(year%4==0)
System.out.println("year is leap");
else
System.out.println("year is not leap");
}
}
}
24 Aug 2010 - 6:01am by Anonymous (not verified)
The algorithm listed in the previous comment is *not* correct for determining leap years, at least for the Gregorian calendar, i.e. the calendar recognized internationally.
class leap
{
public static void main(String[] args)
{
int year=2012;
{
if(year%4==0)
System.out.println("year is leap");
else
System.out.println("year is not leap");
}
}
}
The algorithm listed in the previous comment is *not* correct for determining leap years, at least for the Gregorian calendar, i.e. the calendar recognized internationally.