Java Date Time - Year isLeap() example








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

Syntax

isLeap has the following syntax.

public boolean isLeap()

Example

The following example shows how to use isLeap.

import java.time.Year;
/*from  w  w  w . j  av a  2s .co m*/
public class Main {
  public static void main(String[] args) {
    Year y = Year.of(2014);
    
    System.out.println(y.isLeap());

  }
}

The code above generates the following result.