Year isLeap() example

Description

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;
/*ww  w .  jav a  2s  .com*/
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.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset