On Tue, 17 Jul 2007 06:24:43 -0000, "M.Ponmalar@gmail.com"
<M.Ponmalar@gmail.com> wrote, quoted or indirectly quoted someone who
said :
>Can anyone tell me what is the difference between the two assignments
>String ref = "HAI";
>String obj = new String("HAI");
The second creates a duplicate object, needlessly. The first just
assigns a reference to an existing interned string literal object

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com