Quick Answer
String is immutable - every "modification" creates a new String object. StringBuilder is mutable and fast but not thread-safe - use in single-threaded string building. StringBuffer is mutable and thread-safe (synchronized) but slower. For string concatenation in loops, always use StringBuilder to avoid creating many intermediate String objects. Java 9+ optimizes simple concatenations automatically.
Answer
String is immutable. StringBuilder is mutable and faster but not thread-safe. StringBuffer is thread-safe (synchronized).
S
SugharaIQ Editorial Team
Verified Answer
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.