Java LocalDate create from builder pattern

Description

Java LocalDate create from builder pattern

import java.time.LocalDate;
import java.time.Year;

public class Main {
   public static void main(String[] args) {
      // Use a builder pattern to build a date 2020-05-22
      LocalDate d1 = Year.of(2020).atMonth(5).atDay(22);
      System.out.println(d1);//  ww  w.  j  a v  a 2  s  .  c  o m

   }
}



PreviousNext

Related