isBefore() method of the
MonthDay class used to check if this MonthDay is before the MonthDay passed as parameter or not. This method returns a boolean value showing the same.
Syntax:
public boolean isBefore(MonthDay other)
Parameters: This method accepts one parameter
other which is the other month-day to compare to.
Return value: This method returns true if this MonthDay is before the specified MonthDay else it returns false.
Below programs illustrate the isBefore() method:
Program 1:
Output:
monthday:--10-12 is before monthday:--11-12 = true
Program 2: