Period equals(Object obj)
checks if this period is equal to another period.
equals
has the following syntax.
public boolean equals(Object obj)
The following example shows how to use equals
.
import java.time.Period; // w w w . java 2 s .c o m public class Main { public static void main(String[] args) { Period p = Period.ofDays(12); System.out.println(p.equals(Period.ZERO)); } }
The code above generates the following result.