posted 16 years ago
Hi swati,
Basically the set doesn't allow duplicate values. So when you add string1,null,string2,null,string3,null the set will contain null,string1,string3,string2(Remeber hashset does not guarantee the order). In your code both s1 and s2 contains only one null object.
That is why you have only one null int he result as it is there in s2 also.
Thanks,
vijaya.
Regards,<br />Vijaya Bharath.<br />SCJP1.4 <br />SCWCD5.0