Leap Year Program in Java

A Leap Year is a year that has 366 days. This year February is of 29 days. Leap years occur in every four years.

A leap year has the following constraints.

We can check Leap Year Program in Java as below

  • A year is divisible by 400 then it is a leap year
  • A year is divisible by 4 and not divisible by 100 then the year is a leap year

Q Write a Leap Year Program in Java

Q write a program to decide whether input year is leap year or not.

See another program. Here Scanner class is used to take value from the user.

Q Write a program to check the given year 2004 leap year or not

To check this pass the value to the above program it will produce the following data