Other Object methods
The Object class declares a number of methods. In addition to equals(), some important methods are hashCode() and toString(). We're not going to implement hashCode() in this section because it requires us to do a little more math than is really wieldy, but I would very much recommend that you check out how hashCode() works by going to the documentation and exploring it.
For now, let's just know that an object's hashCode() method should return an integer value that describes that particular object. In all instances, if two objects are found to be equal through the equals() method, their hashCode() functions should also return the same integer value. If two objects are not equal, as far as the equals() method is concerned, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access