Year plus(long amountToAdd, TemporalUnit unit) example
Description
Year plus(long amountToAdd, TemporalUnit unit)
returns a copy of this year with the specified amount added.
Syntax
plus
has the following syntax.
public Year plus(long amountToAdd, TemporalUnit unit)
Example
The following example shows how to use plus
.
import java.time.Year;
import java.time.temporal.ChronoUnit;
//from w w w.ja v a 2 s. c o m
public class Main {
public static void main(String[] args) {
Year y = Year.of(2014);
Year l = y.plus(2,ChronoUnit.YEARS);
System.out.println(l);
}
}
The code above generates the following result.