Java Date Time - MonthDay isAfter(MonthDay other) example








MonthDay isAfter(MonthDay other) checks if this month-day is after the specified month-day.

Syntax

isAfter has the following syntax.

public boolean isAfter(MonthDay other)

Example

The following example shows how to use isAfter.

import java.time.Month;
import java.time.MonthDay;
//from  w  w  w .j a v  a 2  s . co  m
public class Main {
  public static void main(String[] args) {
    MonthDay m = MonthDay.now();
    
    System.out.println(m.isAfter(MonthDay.of(Month.APRIL, 1)));

  }
}

The code above generates the following result.