This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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 ]