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
Can we clone singleton object?
What is the use of static methods?
Tell me the latest versions in java related areas?
Is 64bit faster than 32 bit?
State differences between C and Java?
List out five keywords related to exception handling ?
Can we declare a class as static?
What are the differences between path and classpath variables?
What is array in java?
Why you should not use singleton?
How to disable caching on back button of the browser?
What is the difference between yielding and sleeping?
5 Coding best practices you learned in java?
Where are the card layouts used?
What is a stringbuilder?