Difference in String declaration

Hello All,

Can any one please tell me whats the difference between following String declarations:

a)String str = "abc";

b)String str = new String( "abc" );

Also please tell me which one is correct way of declaration and in which sence.

Thanks in advance..........

[301 byte] By [sureshsarmaa] at [2007-11-27 3:32:33]
# 1
both are different the first one creates one String object and one reference variable. The second one creates two string objects, one in non-pool memory and the reference variable will refer to it., the second object is the literal that will be placed in the pool.
Swing_guya at 2007-7-12 8:35:34 > top of Java-index,Desktop,Core GUI APIs...