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