String vs StringBuilder vs StringBuffer

String vs StringBuilder vs StringBuffer

StringStringBuilderStringBuffer
MutabilityImmutableMutableMutable
Thread SafetyThread-safeNot thread-safeThread-safe
Use CaseSuitable for values that won’t changeBest for strings that are expected to change frequently in a single-threaded environmentSuitable for strings that are modified by multiple threads