Learn Java Programming - Overriding the .equals() Method Tutorial

preview_player
Показать описание
Before watching this tutorial I highly recommend watching my Overriding the .hashCode() method Tutorial as it important to understand what a hash code is and how to override that method. The Object class contains eleven methods; over half of those methods are somehow dependent upon other methods within the Object class to function properly. In a previous tutorial I discussed the relationship between the .wait() method and the .notify() and .notifyAll() methods. One of the most widely used methods, .equals(), shares a special relationship with the .hashcode() method. At this point you should already be familiar with invoking the .equals() method on an object. The purpose of this tutorial is to explain how to override the .equals() method.
Рекомендации по теме
Комментарии
Автор

I appreciate your efforts on these wonderful tutorials especially the detailed focused explanations.., thx again. Best of luck, and keep it up!

mrphysics
Автор

So is it correct saying that two objects that are not equal can have similar hash codes and for two objects to be truly equal they should have similar hash codes?

kevinbenavides