Example usage for java.time Year plusYears

List of usage examples for java.time Year plusYears

Introduction

In this page you can find the example usage for java.time Year plusYears.

Prototype

public Year plusYears(long yearsToAdd) 

Source Link

Document

Returns a copy of this Year with the specified number of years added.

Usage

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);
    Year l = y.plusYears(2);
    System.out.println(l);/*from ww w.  j  a v a 2s.  com*/

}

From source file:Main.java

public static void main(String[] args) {
    Year y1 = Year.of(2014);
    System.out.println(y1);// w w w .j av  a2s. com
    Year y2 = y1.minusYears(1);
    System.out.println(y2);
    Year y3 = y1.plusYears(1);
    System.out.println(y3);
    Year y4 = Year.now();
    System.out.println(y4);
    if (y1.isLeap()) {
        System.out.println(y1 + "  is a  leap year.");
    } else {
        System.out.println(y1 + "  is not  a  leap year.");
    }

}