String pool

Hello,String str = "foo";or String str = new String("foo");Both of these put the "foo" value into the string pool?
[149 byte] By [xyzta] at [2007-11-26 18:22:00]
# 1
Yep, but the second form alse creates a second (superfluous) Stringobject. Both String objects still have their internal character array storedin the pool though.kind regards,Jos
JosAHa at 2007-7-9 5:55:53 > top of Java-index,Java Essentials,Java Programming...
# 2
> Both of these put the "foo" value into the string pool?<pbs>Actually it depends on wether "foo" is already in the pool or not.</pbs>
floundera at 2007-7-9 5:55:53 > top of Java-index,Java Essentials,Java Programming...