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 / punch
Their is NO need to override any methods of student class,
bcoz in the ket of hashmap we are using String and equal
method and hashcode method of String class is already
overrided . So NO need to override any methods and take help
of String class of the same.
| Is This Answer Correct ? | 1 Yes | 7 No |
Post New Answer View All Answers
Is empty string in java?
Explain about object oriented programming and its features?
How can constructor chaining be done by using the super keyword?
Why is java called java?
Is null in java?
How would you format a date in java? I.e. In the ddmmyyy format?
How does thread synchronization occurs inside a monitor?
How do I write a self declaration?
How will you reverse a link list without using recursion?
What is dynamic binding(late binding)?
What is ‘is-a ‘ relationship in java?
Can singleton class be inherited in java?
What are scriptlets?
What is the properties class in java programming?
Can a class be declared as protected?