In this tutorial, we are going to write a Java program to check whether a given number is a leap year or not in java Programming with practical program code and step-by-step full complete explanation.

Java program to check for leap year


Java program to check for leap year.

 
public class DetermineLeapYearExample 
{
	public static void main(String[] args) 
	{
		int year = 2004;
		if((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0)))
			System.out.println("Year " + year + " is a leap year");
		else
			System.out.println("Year " + year + " is not a leap year");
	}
}


Output

 
Year 2004 is a leap year