Clock instant() example
Description
Clock instant()
gets the current instant of the clock
representing the current instant as defined by the clock.
Syntax
instant
has the following syntax.
public abstract Instant instant()
Example
The following example shows how to use instant
.
import java.time.Clock;
// ww w . ja va 2s . c om
public class Main {
public static void main(String[] args) {
Clock clock = Clock.systemUTC();
System.out.println(clock.instant());
}
}
The code above generates the following result.