Java Date Time - LocalDate isEqual(ChronoLocalDate other) example








LocalDate isEqual(ChronoLocalDate other) checks if this date is equal to the specified date.

Syntax

isEqual has the following syntax.

public boolean isEqual(ChronoLocalDate other)

Example

The following example shows how to use isEqual.

import java.time.LocalDate;
//from www. ja va2  s  .  c  o m
public class Main {
  public static void main(String[] args) {
    LocalDate a = LocalDate.of(2014, 6, 30);
    LocalDate b = LocalDate.of(2014, 7, 1);
    System.out.println(a.isEqual(b)); 
    System.out.println(a.isEqual(a)); 
    System.out.println(b.isEqual(a)); 
  }
}

The code above generates the following result.