Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.Period;
import java.time.temporal.ChronoUnit;
import java.time.temporal.Temporal;
import java.time.temporal.TemporalAdjuster;
import java.time.temporal.TemporalAdjusters;

public class Main {

    public static void main(String[] args) {
        TemporalAdjuster temporalAdjuster = (Temporal t) -> t.plus(Period.ofDays(10));

        System.out.println(temporalAdjuster);

        TemporalAdjuster fourMinutesFromNow = temporal -> temporal.plus(4, ChronoUnit.MINUTES);

        LocalTime localTime1 = LocalTime.of(12, 0, 0);
        System.out.println(localTime1.with(temporal -> temporal.plus(4, ChronoUnit.MINUTES)));

        System.out.println(Instant.now().with(temporalAdjuster));

        LocalDate localDate1 = LocalDate.of(2013, 12, 13);
        System.out.println(localDate1.with(TemporalAdjusters.lastDayOfMonth()));

    }
}