Ryan, strings are immutable. What s = (s + "from java") is doing is that it's creating another string and "s" is now referencing that new string, which is "This is a test! from java" it no longer points to "This is a test!". Bosun
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Well . . . the effect is as though you had used an append, that is not necessarily what happens.
184.108.40.206 Optimization of String Concatenation An implementation may choose to perform conversion and concatenation in one step to avoid creating and then discarding an intermediate String object. To increase the performance of repeated string concatenation, a Java compiler may use the StringBuffer class or a similar technique to reduce the number of intermediate String objects that are created by evaluation of an expression.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Jun 28, 2000
Thanx guys...I was thinking that it would puke, I wasn't thinking that it would just change the reference. Ryan