Year now(ZoneId zone) example
Description
Year now(ZoneId zone)
creates
the current year from the system clock in the specified time-zone.
Syntax
now
has the following syntax.
public static Year now(ZoneId zone)
Example
The following example shows how to use now
.
import java.time.Year;
import java.time.ZoneId;
// ww w . j a v a 2 s .co m
public class Main {
public static void main(String[] args) {
Year y = Year.now(ZoneId.systemDefault());
System.out.println(y);
}
}
The code above generates the following result.