Java Data Type How to - Get a particular date in Java 8








Question

We would like to know how to get a particular date in Java 8.

Answer

import java.time.LocalDate;

public class Main {
  public static void main(String[] argv) {
    LocalDate dateOfBirth = LocalDate.of(2010, 1, 14);
    System.out.println("Your Date of birth is : " + dateOfBirth);

  }
}

The code above generates the following result.