Year query(TemporalQuery query) example
Description
Year query(TemporalQuery<R> query)
queries this year using the specified query.
Syntax
query
has the following syntax.
public <R> R query(TemporalQuery<R> query)
Example
The following example shows how to use query
.
import java.time.Year;
import java.time.chrono.Chronology;
import java.time.temporal.TemporalQueries;
//from w w w . j av a 2 s . c o m
public class Main {
public static void main(String[] args) {
Year y = Year.of(2014);
Chronology l = y.query(TemporalQueries.chronology());
System.out.println(l);
}
}
The code above generates the following result.