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

How to call one constructor from the other constructor ?

996


What is a super method?

934


What is array size in java?

923


Is passing by reference faster?

950


Explain runtime exceptions?

1122


What is OOP Language?

1027


What is the collections api in java programming?

937


What is hashmap in java?

1026


What is a byte array?

1057


What are 3 boolean operators?

950


What is a class component?

1125


What is boolean flag in java?

1043


Why can't we override private static methods?

930


Can we use a default constructor of a class even if an explicit constructor is defined?

1057


What is the requirement of thread in java?

1003