Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Is empty string in java?

1180


Explain about object oriented programming and its features?

1013


How can constructor chaining be done by using the super keyword?

1094


Why is java called java?

1053


Is null in java?

1017


How would you format a date in java? I.e. In the ddmmyyy format?

1379


How does thread synchronization occurs inside a monitor?

1101


How do I write a self declaration?

1111


How will you reverse a link list without using recursion?

1033


What is dynamic binding(late binding)?

1051


What is ‘is-a ‘ relationship in java?

1038


Can singleton class be inherited in java?

1003


What are scriptlets?

1088


What is the properties class in java programming?

1004


Can a class be declared as protected?

1014