MonthDay of(Month, int) method in Java with Examples
The of(Month month, int dayOfMonth) method of the MonthDay class in Java is used to get an instance of MonthDay.
public static MonthDay of( Month month, int dayOfMonth)
Parameters: This method accepts two parameters:
- month: It represents the month of year.
- dayOfMonth: It represents the day of month.
Return value: This method returns the month-day.
Exceptions: This method throws DateTimeException if the value of any field is out of range or the day of month is invalid for the month.
Below programs illustrate the of(Month month, int dayOfMonth) method of MonthDay in Java:
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.