LocalTime query(TemporalQuery query) example
Description
LocalTime query(TemporalQuery<R> query)
queries this time 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.LocalTime;
import java.time.temporal.TemporalQueries;
// w ww . java 2 s.c om
public class Main {
public static void main(String[] args) {
LocalTime l = LocalTime.now();
LocalTime s = l.query(TemporalQueries.localTime());
System.out.println(s);
}
}
The code above generates the following result.