MonthDay equals(Object obj) example
Description
MonthDay equals(Object obj)
checks if
this month-day is equal to another month-day.
Syntax
equals
has the following syntax.
public boolean equals(Object obj)
Example
The following example shows how to use equals
.
import java.time.Month;
import java.time.MonthDay;
// ww 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.equals(MonthDay.of(Month.APRIL, 1)));
}
}
The code above generates the following result.