ZoneId equals() method in Java with Examples
equals() method of the ZoneId class used to compare this ZoneId to the ZoneId object passed as parameter. The value to be returned by this method is determined as follows:
- if both ZoneId are equal, then true is returned
- if both ZoneId are not equal, then false is returned.
public boolean equals(Object obj)
Parameters: This method accepts a single parameter obj which represents the object to compare with this ZoneId, It can’t be null.
Return value: This method returns true if both ZoneId are equal else false.
Below programs illustrate the equals() method:
Both ZoneIdsare equal: false
Both ZoneIdsare equal: true
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.