Year getLong(TemporalField field)
gets the value of the specified field from this year as a long.
getLong
has the following syntax.
public long getLong(TemporalField field)
The following example shows how to use getLong
.
import java.time.Year; import java.time.temporal.ChronoField; /* w w w . ja v a2s .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.