on 1/25/01 11:42 AM, "Paul Speed" <[EMAIL PROTECTED]> wrote:

> Just thought that I would point out that:
> "My " + "dog " + "has " + "fleas." will be compiled as one String:
> "My dog has fleas." and incurs no runtime penalties.  In the case
> of literals it can be more efficient than StringBuffer as long as
> they are grouped together as above.  Since I haven't looked at the
> code directly, I don't know how or if this affects your point.
> 
> -Paul Speed

True, but not in a loop.

ie:

String foo = "";
for ( int i = 0; i< NUMBER; i++ )
{
   foo = foo + i;
}

That will produce a big mess. Best to use a StringBuffer.append in that
case.

-jon

-- 
Honk if you love peace and quiet.



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

Reply via email to