7) Suppose there is Student class like
class student {
int age;
string name;
}
We want to store these objects in a HashMap. Do we need to
override any methods in Student class? If any which ones
and why? what if i just override equals or just hashcode?
what will be the results in both the cases?
Answer Posted / krishna
There is no need to override equals() and hashCode() methods. But if we want to eliminate duplicate objects in the HashMap, you should override both the methods. Either one is not enough.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is linkedlist in java?
What the difference is between execute, execute Query, execute Update?
What is method reference in java?
Name some OOPS Concepts in Java?
What do you mean Abstraction in java?
Give me example of derived data types.
What is object of class in java?
How to access arraylist elements in java?
enlist some features of jdk.
Is java a pure object oriented language?
Which package has light weight components in java programming?
what is meant wrapper classes?
What is parseint?
What is an exception in java?
Difference between stack and queue?