Clock instant()
gets the current instant of the clock
representing the current instant as defined by the clock.
instant
has the following syntax.
public abstract Instant instant()
The following example shows how to use instant
.
import java.time.Clock; 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.