Java Date Time - Year isLeap(long year) example








Year isLeap(long year) checks if the year is a leap year, according to the ISO proleptic calendar system rules.

Syntax

isLeap has the following syntax.

public static boolean isLeap(long year)

Example

The following example shows how to use isLeap.

import java.time.Year;

public class Main {
  public static void main(String[] args) {

    System.out.println(Year.isLeap(2014));

  }
}

The code above generates the following result.