We would like to check if a year is a leap year.
For example, year 2000 is a leap year
public class Main { public static void main(String[] args) { int year = 2004; //your code } }
public class Main { 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"); } }