String object is read only (immutable) that means string object cannot be
modified .Some  methods seems to modify the string object but actually they
are not modifying the object but creating the new object.

String builder object is mutable ,it can modify the object by
appending,removing,replacing etc.
Here when the object is modified it is refering to the same instance where
as in string class a new object is creates

Performance:

Concat method of *String* class and Append Method of StringBuilder class
both concatenate 2 strings.But the  string class creates new object  from
existing object which allocates memory where as  A *StringBuilder* object
maintains a buffer to accommodate the concatenation of new data. New data is
appended to the end of the buffer if room is available; otherwise, a new,
larger buffer is allocated, data from the original buffer is copied to the
new buffer, then the new data is appended to the new buffer.

Performance depends on memory allocation,string always allocates memory
where as string builder object allocates only wehn buffer is full.

String Builder object gives higher performance compared to string





On Fri, Jan 16, 2009 at 3:19 AM, Peter Smith <[email protected]> wrote:

>
> The first one is a datatype. The other two are typos.
>

Reply via email to