Example usage for java.time YearMonth plus

List of usage examples for java.time YearMonth plus

Introduction

In this page you can find the example usage for java.time YearMonth plus.

Prototype

@Override
public YearMonth plus(long amountToAdd, TemporalUnit unit) 

Source Link

Document

Returns a copy of this year-month with the specified amount added.

Usage

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    YearMonth s = y.plus(3, ChronoUnit.YEARS);
    System.out.println(s);/*from   w  w w .  j  ava 2 s.  c  o m*/

}