Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.Month;
import java.time.Year;
import java.time.temporal.TemporalAdjusters;

public class Main {

    public static void main(String[] args) {
        System.out.println(thanksgiving(2014));
    }

    private static LocalDate thanksgiving(int year) {
        LocalDate thanksGiving = Year.of(year).atMonth(Month.NOVEMBER).atDay(1)
                .with(TemporalAdjusters.lastInMonth(DayOfWeek.WEDNESDAY));
        return thanksGiving;
    }
}