Hash code method returns integer. If range of
integer finishes then also two different object will have same hashCode. So it
is not necessary that two different object will have same hashCode are equal. So, If the two objects have same name, then
they would be equal, but still if their string field has different
length, then
their hashCodes will be different.
That is why, you should always
use the
same fields in equals and hashCode calculation.