| Author |
Creating new Strings
|
jose chiramal
Ranch Hand
Joined: Feb 12, 2010
Posts: 266
|
|
String s ="abc" // Creates one String object and one reference variable. How ?
String s = new String("abc") // Creates two objects, and one reference variable. How ?
Can someone please explain the above two comments.
|
 |
Pushkar Choudhary
Rancher
Joined: May 21, 2006
Posts: 425
|
|
This question has been asked many times. Please SearchFirst.
A couple of threads discussing the same here and here.
|
 |
Yogesh Gnanapraksam
Ranch Hand
Joined: Dec 17, 2009
Posts: 133
|
|
Also this thread could be useful
http://www.coderanch.com/t/488922/Java-General/java/new-keyword-objects-Java#2199295
|
 |
 |
|
|
subject: Creating new Strings
|
|
|