> Paul,
> 
> Actually, my investigations in the past have shown that (at least in
> Sun's JDK 1.2) this is implemented as:
> 
> new StringBuffer 
> ("My").append("dog").append("has").append("fleas").toString();
> 
> It is also possible to write a statement like:
> 
>       "My" + "dog" + '.'
>       
> The ability to concatenate a char points at an underlying StringBuffer
> implementation, which supports append(String) and 
> append(char) methods.
> 
> 
> Last paragraph in the java.lang.String javadoc says:
> 
> The Java language provides special support for the string 
> concatentation operator
> ( + ), and for conversion of other objects to strings. String 
> concatenation is
> implemented through the StringBuffer class and its append 
> method. String
> conversions are implemented through the method toString, 
> defined by Object and
> inherited by all classes in Java. For additional information 
> on string concatenation
> and conversion, see Gosling, Joy, and Steele, The Java 
> Language Specification. 
> 
> 

On a performance note, doesn't it strike anybody the methods
on StringBuffer are declared 'synchronized' is a bad thing?

Object creation and synchronization are 2 of the most costly operations in
Java.


- Chris. 

Brainbench MVP Java2.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to