The total number of days in a year is 365 days. But a leap year has 365 days + 1 day = 366 days, In a leap year, the February month is 29 days instead of 28. A leap occurs once every four years.

To check whether the year is a leap year or not, we can check it through the simple Java program given below.

Program: Java Leap Year Program

Output 1:

Enter the valid Year: 2022 2022 is not a leap year.

We are passing the year 2022, It value is not divided by 4 so It's not a leap year.

Output 2:

Enter the valid Year: 1900 1900 is not a leap year.

We are passing the year 1900, since 1900 is a century year, 1900 is divided by 4 and 100 but not divided by 400 so it is not a leap year.

A century is a period of 100 years, it is ending with 00 and in the Java programming it must be divided by 4 and 400.

Output 3:

Enter the valid Year: 2000 2000 is a leap year.

We are passing the year 2000, 2000 is also a century year and a leap year also because it is divided by 4 and 400 both.

That's all guys, hope this Java Program is helpful for you.

Happy Learning... 😀

Please share this article on social media to help others.

If you have any query or suggestion regarding this artical please share with us feedback@javabytechie.com