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.temporal.TemporalAdjusters;
import java.util.ArrayList;
import java.util.List;

public class Main {
    public static void main(String[] argv) {
        List<DayOfWeek> list = new ArrayList<>();

        for (Month month : Month.values()) {
            DayOfWeek day = LocalDate.now().withYear(2010).with(month).with(TemporalAdjusters.lastDayOfMonth())
                    .getDayOfWeek();

            list.add(day);
        }

        System.out.println(list);
    }
}