Check Leap Year in Java:

public class LeapYear {

 public static void main(String[] args) {

 int year = 2024;

 if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {

 System.out.println(year + ” is a leap year.”);

 } else {

 System.out.println(year + ” is not a leap year.”);

 }

 }

Output:

2024 is a leap year.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *