Period plus(TemporalAmount amountToAdd)
returns a copy of this period with the specified period added.
plus
has the following syntax.
public Period plus(TemporalAmount amountToAdd)
The following example shows how to use plus
.
import java.time.Period; /* w ww.j ava 2 s .com*/ public class Main { public static void main(String[] args) { Period p = Period.ofMonths(1); Period l = p.plus(Period.ofMonths(1)); System.out.println(l); } }
The code above generates the following result.