if instead you make: SetExample s2=s1; your output will be: 1
EDITED but, even using your code with that equals(), output still is 2, because those two String Objects are in fact two diferent objects (diferent memory locations, i guess) anyway i think Equals() is incomplete [ August 13, 2006: Message edited by: miguel lisboa ]
Joined: Feb 08, 2004
you also have to override hashCode:
subject: Why am I being able to add Duplicates to this set?