SPIRO THE TECH GURU

Back

What is the basic difference between string and stringbuffer object?

By Admin on

Difference between string and stringbuffer object:

String:

>String class is immutable.

>String is slow and consumes more memory when you concat too many strings because every time it creates new instance.

StringBuffer:

>StringBuffer class is mutable.

>StringBuffer is fast and consumes less memory when you cancat strings.


SPIRO Google Plus