YearMonth isBefore() method in Java with Examples
The isBefore() method of Year class in Java is used to check if this current YearMonth object is before the YearMonth specified as parameter to this method.
public boolean isBefore(Year otherYearMonth)
Parameter: It accepts a single parameter otherYearMonth with which the current YearMonth object is to be compared.
Return Value: It returns a boolean True value if this YearMonth object’s value is before the value of YearMonth object specified as a parameter to the method, otherwise it returns False.
Below programs illustrate the YearMonth.isBefore() method 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.