Java LocalDate check leap year

Description

Java LocalDate check leap year


import java.time.LocalDate;
import java.time.Month;

public class Main {
  public static void main(String[] args) {
    // Create a local date and time
    LocalDate ld = LocalDate.of(2020, Month.MAY, 11);

    System.out.println("ld: " + ld);
    System.out.println("ld.isLeapYear(): " + ld.isLeapYear());

  }/*from  w ww.j a va 2 s .c  o m*/
}



PreviousNext

Related