aspose file tools*
The moose likes Java in General and the fly likes Difference between Set <String>s=new HashSet<String>() and HashSet <String>s=new HashSet<String>(); Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Difference between Set <String>s=new HashSet<String>() and HashSet <String>s=new HashSet<String>();" Watch "Difference between Set <String>s=new HashSet<String>() and HashSet <String>s=new HashSet<String>();" New topic
Author

Difference between Set <String>s=new HashSet<String>() and HashSet <String>s=new HashSet<String>();

chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Hi everybody, I am Chaitanya, please can anyone tell me the difference between Set <String>s=new HashSet<String>() and HashSet <String>s=new HashSet<String>();

Thank you all in advance. Have a good day.


Love all, trust a few, do wrong to none.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

In the first case you have a Set reference to a HashSet
And in the second case you have a HashSet reference to a HashSet.

Search for "Programming against an interface".


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

I am sorry Mr.Wouter, I dint understood, can you please explain me in brief?
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

I understood the difference Mr.Wouter. This link helped me.

Thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between Set <String>s=new HashSet<String>() and HashSet <String>s=new HashSet<String>();