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 is meant by object oriented programming – oop?
What is the purpose class.forname method?
What languages are pass by reference?
Define locale.
What are the advantages of exception handling?
What is string [] java?
Why collection doesn’t extend cloneable and serializable interfaces?
Can we convert list to set in java?
Are functions objects in java?
What is the base class of all classes?
What two classes are used to read data only?
Is Java a dying language?
What is difference between local variable and global variable?
What is jar?
How can we run a java program without making any object?