Year now(Clock clock) example
Description
Year now(Clock clock)
creates the current year from the specified clock.
Syntax
now
has the following syntax.
public static Year now(Clock clock)
Example
The following example shows how to use now
.
import java.time.Clock;
import java.time.Year;
//w w w . ja va 2 s. com
public class Main {
public static void main(String[] args) {
Year y = Year.now(Clock.systemDefaultZone());
System.out.println(y);
}
}
The code above generates the following result.