/** * @author lautturi.com * Java example: check whether a year is leap year or not */ import java.util.*; public class Lautturi { public static void main(String[] args) { int year = 2000; if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))){ System.out.println(year+" is leap year"); }else { System.out.println(year+" is not a leap year"); } } }
output:
2000 is a leap year