YearMonth of(int year, Month month) example
Description
YearMonth of(int year, Month month)
creates an instance of YearMonth from a year and month.
Syntax
of
has the following syntax.
public static YearMonth of(int year, Month month)
Example
The following example shows how to use of
.
import java.time.Month;
import java.time.YearMonth;
/*w w w . j av a 2 s .com*/
public class Main {
public static void main(String[] args) {
YearMonth y = YearMonth.of(2013,Month.JANUARY);
System.out.println(y);
}
}
The code above generates the following result.