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...

suppose in a class there is a code like this:
{
Set hs=new Hashset();
hs.add(new Emp("kathy",1000));
hs.add(new Emp("kathy",2000));
}
how can u avoid the above code in your class as set won't
allow duplicate objects?

Answer Posted / mushtaq hussain

by implementing equals and toHashCode method in emp Class

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you extend singleton class?

1155


What are the differences between heap and stack memory?

1144


Who developed java?

1056


How to declare objects of a class ?

1127


When is the garbage collection used in Java?

1262


What is ‘has a’’ relationship in java?

1277


Is node a data type in java?

1060


Explain abstract class in java?

1127


placement papaers of spring computing technology

1456


Is null == null in java?

1163


What are the differences between forwarding () method and sendredirect() methods?

1147


What is polymorphism java example?

1069


Are functions objects in java?

1127


What does a za z0 9 mean?

1184


What is the purpose of main function in java?

1077