java.lang.String. - Java
This is a discussion on java.lang.String. - Java ; Can anyone tell me what is the difference between the two assignments
String ref = "HAI";
String obj = new String("HAI");...
-
java.lang.String.
Can anyone tell me what is the difference between the two assignments
String ref = "HAI";
String obj = new String("HAI");
-
Re: java.lang.String.
On Tue, 17 Jul 2007 06:24:43 -0000, "M.Ponmalar"
<M.Ponmalar> 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
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Similar Threads
-
By Application Development in forum Java
Replies: 4
Last Post: 07-04-2007, 02:45 PM
-
By Application Development in forum Java
Replies: 0
Last Post: 07-03-2007, 10:49 PM
-
By Application Development in forum Java
Replies: 8
Last Post: 03-26-2007, 08:49 AM
-
By Application Development in forum Java
Replies: 0
Last Post: 10-05-2004, 11:25 AM
-
By Application Development in forum Java
Replies: 0
Last Post: 10-05-2004, 11:24 AM