object or reference variable

how many object will be created if we use this String s=new String("abc")i read as two how ?normally s is an reference variable it only get a reference of String ....
[194 byte] By [gopiMCAa] at [2007-11-27 9:07:27]
# 1
"abc" will be stored in the constants string pool, and a new String will be also be created.
BIJ001a at 2007-7-12 21:44:12 > top of Java-index,Java Essentials,Java Programming...
# 2
and others objects that are used inside String class, like StringBuilder...
pbulgarellia at 2007-7-12 21:44:12 > top of Java-index,Java Essentials,Java Programming...
# 3
"abc" is an string object created on the fly an stored in string pool ..with new String() a new object is created with value passed in its constructor.Message was edited by: JL.Nayak
JL.Nayaka at 2007-7-12 21:44:12 > top of Java-index,Java Essentials,Java Programming...
# 4
If u want to perform string manipulation - concat - truncate some chars, etc..use String Builder or StringBuffer
vinayak_ra at 2007-7-12 21:44:12 > top of Java-index,Java Essentials,Java Programming...
# 5

When the code stone in the memery, the "abc" is seted on the stack, "new String()" will create the object but not create a char[] as "abc":

public String(String original) {

int size = original.count;

char[] originalValue = original.value;

char[] v;

if (originalValue.length > size) {

// The array representing the String is bigger than the new

// String itself. Perhaps this constructor is being called

// in order to trim the baggage, so make a copy of the array.

v = new char[size];

System.arraycopy(originalValue, original.offset, v, 0, size);

} else {

// The array representing the String is the same

// size as the String, so no point in making a copy.

v = originalValue;

}

this.offset = 0;

this.count = size;

this.value = v;

}

Stone.lia at 2007-7-12 21:44:12 > top of Java-index,Java Essentials,Java Programming...
# 6
It will create only one object for this.
KeDeSola at 2007-7-12 21:44:12 > top of Java-index,Java Essentials,Java Programming...
# 7
> It will create only one object for this.Wrong.Why do you people insist on answering with false information?
-Kayaman-a at 2007-7-12 21:44:12 > top of Java-index,Java Essentials,Java Programming...
# 8
> String s=new String("abc")The execution of this line will create one object, due to the new String.One other String object will already have been created when the class was loaded, and stored in the literal pool, due to the literal "abc".
jverda at 2007-7-12 21:44:12 > top of Java-index,Java Essentials,Java Programming...