0

afaik,

string is immutable and string buffer is mutable.
when we concatenate characters with string new string object will be created.
but when we append string buffer it remains the same object.

apart from these what are the key and other difference between them?.

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by zerocool21
0

P.S. unless the spot where you're using a StringBuffer is "thread" sensitive, use a StringBuilder rather than a StringBuffer. A StringBuffer is "synchronized" whereas a StringBuilder is not, making a StringBuilder more performant when synchronization is not an issue.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.