ZoneOffset equal(Object) method in Java with Examples
The equals(Object) method of ZoneOffset Class in java.time package is used to check whether the another instance of ZoneOffset passed as the parameter to this ZoneOffset instance, is equal or not. This method returns a boolean value stating the same.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
public boolean equals(Object object)
Parameters: This method accepts accepts a parameter object which is to be is equal to this ZoneOffset instance.
Return Value: This method returns a boolean value stating whether this ZoneOffset is equal to the instance passed as the parameter.
Below examples illustrate the ZoneOffset.equals() method:
ZoneOffset 1: +05:00 ZoneOffset 2: +05:00 ZoneOffset 1 is equal to ZoneOffset 2: true
ZoneOffset 1: +05:00 ZoneOffset 3: +03:00 ZoneOffset 1 is equal to ZoneOffset 3: false
Reference: Oracle Doc