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

how to write a program for sending mails between client and server

2073


How are observer and observable used in java programming?

1029


What does \ mean in regex?

1222


What is callable java?

980


What is the significance of listiterator?

1101


What is a heavyweight component?

1025


Write a java program to count the number of words present in a string?

983


What if constructor is protected in java?

1124


What are the different ways to handle exceptions?

1000


What exactly is a .class file?

1046


What are the two ways to create a thread?

1008


What is illegal identifier in java?

1015


When is the garbage collection used in Java?

1202


how we can make a read-only class in java?

994


Where is stringbuffer stored?

985