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