MonthDay isValidYear() Method in Java with Examples
isValidYear() method of the MonthDay class used to check if the specified year is valid for this month-day.This can only return false for February 29th.
public boolean isValidYear?(int year)
Parameters: This method accepts one parameter year which is the year to validate.
Return value: This method returns returns boolean value true if the year is valid for this month-day.
Below programs illustrate the isValidYear() method:
Year 2012 is valid for monthday: --10-12 = true
Year 2017 is valid for monthday: --02-29 = false
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.