Close

Java Date Time - Year.getValue() Examples

Java Date Time Java Java API 


Class:

java.time.Year

java.lang.Objectjava.lang.Objectjava.time.Yearjava.time.Yearjava.time.temporal.TemporalTemporaljava.time.temporal.TemporalAdjusterTemporalAdjusterjava.lang.ComparableComparablejava.io.SerializableSerializableLogicBig

Method:

public int getValue()

Returns the year value as int from this Year object.


Examples


package com.logicbig.example.year;

import java.time.Year;

public class GetValueExample {

public static void main(String... args) {
Year y = Year.now();
System.out.println(y);

int value = y.getValue();
System.out.println(value);
}
}

Output

2017
2017




See Also