The given program is to check if the given year is a leap year or not. A typical year is of 365 days. A year with 366 days is known as a leap year. After at regular intervals, there is a leap or jump year.
Leap year conditions:
(Remainder (Year/ 4) = 0 “AND” Remainder (Year/ 100) != 0 ) “OR” Remainder (Year/ 400) = 0.
Example:
2012, 2026, 2020, etc.
Program to Determine If Year Is Leap Year Java.
/**
* Program to Determine If Year Is Leap Year Java Example.
* @author W3schools360
*/
public class LeapYearExample {
static void leapArea(int year){
//Check Leap year condition.
if((year
System.out.println(year + ": Leap year.");
}else{
System.out.println(year + ": Not a leap year.");
}
}
public static void main(String args[]){
//method call
leapArea(2016);
}
}
Output:
2016: Leap year.