Java Date Time - MonthDay atYear(int year) example

MonthDay atYear(int year) combines this month-day with a year to create a LocalDate.


atYear has the following syntax.

public LocalDate atYear(int year)


The following example shows how to use atYear.

import java.time.LocalDate;
import java.time.MonthDay;
/*from   www.  ja v  a2 s.  c  o  m*/
public class Main {
  public static void main(String[] args) {
    MonthDay m =;
    LocalDate n = m.atYear(1990);


The code above generates the following result.