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