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 application of stack?
What is a java string?
How does arraylist size increase in java?
How to add menushortcut to menu item?
Can a constructor be private and how are this() and super() method used with constructor?
what are the high-level thread states? : Java thread
Should you use singleton pattern?
What are controls and their different types in awt?
What is the difference between a method and a function in alice?
why Interface used?
Differentiate jar and war files?
what is the difference between a threads start() and run() methods? : Java thread
How many types of interfaces are there?
Why do we use variables?
Why pass by reference is not possible in java?