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