Question: Question: What is the result when invoking the hashCode() method on two different objects that are considered equal according to the equals() method in Java?
Question: What is the result when invoking the hashCode() method on two different objects that are considered equal according to the equals() method in Java?
A) Both objects will have different hash codes.
B) Both objects will have the same hash code.
C) One object will have a hash code, while the other will have a default hash code value.
D) The hashCode() method will throw an exception if the objects are considered equal.
Step by Step Solution
There are 3 Steps involved in it
The detailed answer for the above question is provided below The correct option is B Both objects will have the same hash code Reason This option is c... View full answer
Get step-by-step solutions from verified subject matter experts
