• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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".
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry Mr.Wouter, I dint understood, can you please explain me in brief?
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understood the difference Mr.Wouter. This link helped me.

Thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic