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 does t in java mean?
How do you escape sequences in java?
When do we need to use internal iteration? When do we need to use external iteration?
Explain which of the following methods releases the lock when yield(), join(),sleep(),wait(),notify(), notifyall() methods are executed?
What are the 3 types of control structures?
Can we catch more than one exception in single catch block?
What is command line argument
Can you write a java class that could be used both as an applet as well as an application?
List two java ide’s?
What does isempty () do in java?
who can i handle multiple client in RMI
What is an 8 bit word?
What do you mean by ternary operator in java?
What is update method called?
What is the output of the below java program?