You can always edit your posts. at the top of each you'll see a little paper/pencil icon. this allows you to edit your posts. You can even delete your post there. Note that if yours is the first post of the
thread and you delete it, the entire thread goes away.
Thanks for changing your name.
Now...
yes, "def" and "abc" will be added to the string pool. EVERY string literal is put in the pool, and you don't have control over this.
Using a StringBuffer actually causes FEWER strings to be abandoned in the heap. A String is immutable. Once it is created, it can never be changed. so when you concatenate Strings, new Strings are created all over the place. each time you use the "+" operator, it's a new String, so
stringone + stringtwo + stringthree + string4;
creates (i believe) 3 strings - two temporary ones that are lost almost as soon as they are created, and one we keep. That is in addition to the four strings we have already created.
The code s1 += "winter" doesn't change the String s1 points to, but creates a brand new string and re-assigns the reference to that new string.
a StringBuffer would change the underlying object itself, thus not causing the object to be lost.
[ March 23, 2007: Message edited by: Fred Rosenberger ]