adspace
If you’re overriding the method equals() of an object, which other method you might also consider?
Answer Posted / Shri Chandra Verma
When overriding the 'equals()' method in a class, it is common to also override the 'hashCode()' method. This is because the 'equals()' and 'hashCode()' methods are often used together in collections like HashSet or HashMap. If the 'hashCode()' method of an object changes over time, it can cause unexpected behavior when dealing with these collections.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the first argument of the string array in main method?
What if I write static public void instead of public static void?
What is the java api?
What is the resourcebundle class?
what is reflection api? How are they implemented?
What is the locale class?
Can we extract main method from another class?
How does java handle integer overflows and underflows?
Are jvm’s platform independent?
What do you understand by casting in java language? What are the types of casting?