The isValidMonthDay() method of Year class in Java is used to check if this Year object and a month-day represented by a MonthDay provided as a parameter to the method together can form a valid date or not.
public boolean isValidMonthDay(MonthDay monthDay)
Parameter: This method accepts a single parameter monthDay which represents a month-day which is need to be examined with this Year object.
Return Value: It returns a boolean True value if this Year object and the given month-day represented by a MonthDay together can form a valid date otherwise it returns False.
Below programs illustrate the isValidMonthDay() method of Year in Java:
Program 2: In the below program, Year is mentioned as 1990 which is not a leap year but month-day represents a leap year. So, they together can not form a valid date so the method will return false.