Mansukhdeep Thind wrote:a) What is a hashCode() of an object ?
It is a numeric
digest that helps to identify it.
(is it the memory location at which it is stored?)
No.
b) What is the significance of hashCodes with respect to how objects are stored in Collections?
1. They only have significance for
hashed collections (eg, java.util.HashMap).
2. Their
effectiveness, in such a context, is directly proportional to how good they are; and that's a bit of a black art.
Effective Java has a very good Item on how to write a good hash which doesn't blind you with maths.
For a more general description, you may also find
this article useful.
Winston