This week's book giveaway is in the Design and Architecture forum. We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read on-line! See this thread for details.
equals() using to comparison, refers to equivalence relations. hashCode() is id number allocated to an object by JVM. Contract: When you use equals() and hashCode() methods is necessary to override these methods
-- If two objects are equal then they should have the same hascode but the reverse is not true (i.e. If two objects have the same hashcode does not mean that they are equal)
-- You need to use the same attributes in your equals & hashCode methods
Besides checking about the implications of equals and hashcode values, the exam may simply ask that if you implement equals() method, which other method you should implement?
SCJP 96% | SCWCD 90%| SCJP mock exams | My SCJP blog
Fire me boy! Cool, soothing, shameless self promotion: