What is the key difference between StringBuffer and StringBuilder?

Last Updated :
Discuss
Comments

What is the key difference between StringBuffer and StringBuilder?

StringBuffer is thread-safe, StringBuilder is not

StringBuilder is synchronized, StringBuffer is not

StringBuffer is immutable, StringBuilder is mutable

StringBuilder consumes more memory than StringBuffer


Share your thoughts in the comments