Java Date Time - Year getValue() example








Year getValue() gets the year value.

Syntax

getValue has the following syntax.

public int getValue()

Example

The following example shows how to use getValue.

import java.time.Year;
/*from  w ww  .ja v a2s .c o m*/
public class Main {
  public static void main(String[] args) {
    Year y = Year.of(2014);
    
    System.out.println(y.getValue());

  }
}

The code above generates the following result.