Java Date Time - Year plus(TemporalAmount amountToAdd) example








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;
/* ww w .  j  a 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(Period.ofYears(12));
    System.out.println(l);

  }
}

The code above generates the following result.