hi,
I have a doubt in question number 7 of SELF
TEST of Chapter 7 (Generics and Collections) of K&B book-
Here is the code-
Options are -
Correct answer is --
3 C and D are correct. If hashCode() is not overridden then every entry will go into its own
bucket, and the overridden equals() method will have no effect on determining equivalency.
If hashCode() is overridden, then the overridden equals() method will view t1 and t2 as duplicates.
-------------------------------------------------------------------
Now, my questions are
1. Will equals method not at all run if there is no hashCode method in our class?
2. What is the sequence of execution of equals and hashCode methods. I suppose hashCode method runs first..am I right?