Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.time.LocalDate;
import java.time.temporal.TemporalAdjuster;
import java.time.temporal.TemporalAdjusters;

public class Main {

    public static void main(String[] args) {
        // Create an adjuster that retruns a date after 3 months and 2 days
        TemporalAdjuster adjuster = TemporalAdjusters
                .ofDateAdjuster((LocalDate date) -> date.plusMonths(3).plusDays(2));

        LocalDate today = LocalDate.now();
        LocalDate dayAfter3Mon2Day = today.with(adjuster);
        System.out.println("Today: " + today);
        System.out.println("After 3  months  and  2  days: " + dayAfter3Mon2Day);

    }
}