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