Java Date Time Java Java API
java.time.MonthDay
public boolean isBefore(MonthDay other)
Checks if this month-day is before the specified month-day.
package com.logicbig.example.monthday;import java.time.MonthDay;public class IsBeforeExample { public static void main(String... args) { MonthDay m1 = MonthDay.of(10, 21); System.out.println(m1); MonthDay m2 = MonthDay.of(5, 15); System.out.println(m2); boolean b = m2.isBefore(m1); System.out.println(b); boolean b2 = m1.isBefore(m2); System.out.println(b2); }}
--10-21--05-15truefalse