Welcome to the Simplilearn Community

Want to join the rest of our members? Sign up right away!

Sign Up

difference between string buffer and string builde...

Girish Kumar S

Well-Known Member
First lets see the similarities..
Both StringBuffer and StringBuilder are mutable
and the main difference is :
StringBuffer is synchronized while StringBuilder is not which makes StringBuilder faster than StringBuffer.


New Member
StringBuffer is thread safe and StringBuilder is not, hence when you need to honor or worry about thread safety you can choose StringBuffer else StringBuilder, in addition to details above.