Year getLong(TemporalField field) example
Description
Year getLong(TemporalField field)
gets the value of the specified field from this year as a long.
Syntax
getLong
has the following syntax.
public long getLong(TemporalField field)
Example
The following example shows how to use getLong
.
import java.time.Year;
import java.time.temporal.ChronoField;
//ww w . j a va2 s . c o m
public class Main {
public static void main(String[] args) {
Year y = Year.of(2014);
System.out.println(y.getLong(ChronoField.YEAR));
}
}
The code above generates the following result.