// 7/2/02
// LeapYear.java
// Figures out if a given year is a leap year.
public class LeapYear
{
public static void main ( String [] args )
{
int year = 1900;
if ( year % 400 == 0 )
PrintLeap ( year );
else if ( year % 100 == 0 )
PrintNotLeap ( year );
else if ( year % 4 == 0 )
PrintLeap ( year );
else
PrintNotLeap ( year );
}
public static void PrintLeap ( int yr )
{
System.out.println ( "\n\nThe year " + yr + " is a leap year!\n\n" );
}
public static void PrintNotLeap ( int nLyr )
{
System.out.println ( "\n\nThe year " + nLyr + " is NOT a leap year.\n\n" );
}
}
Back to Lesson 6 Examples
Back to Java Main Page