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
Explain about fail safe iterators in java?
What is set and get methods in java?
What do you understand by private, protected and public?
what is static import in java? Explain
What does the ‘static’ keyword mean? Is it possible to override private or static method in java?
Can a class declared as private be accessed outside it’s package?
How does multithreading take place on a computer with a single cpu?
What is qms certification?
describe synchronization in respect to multithreading? : Java thread
Explain the difference between intermediate and terminal operations in java8?
What are latest features introduced with java 8?
Can long be null in java?
What is == in java?
define polymorphism in java
What is difference between fail-fast and fail-safe?