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
What are the differences between c++ and java?
What is the program development process?
What is the default value of an object reference declared as an instance variable?
What are the skills required for core java?
Difference between method overloading and overriding.
What do you mean by collectors in java 8?
What is an image buffer?
What does java ide mean?
Why is the main method static?
What is the latest version of java?
Explain when noclassdeffounderror will be raised ?
How many ways can we create singleton class?
List any five features of java?
What are basic data types?
Is it possible for a yielded thread to get chance for its execution again?