Frage im Vorstellungsgespräch bei Citi

Difference between String builder and string buffer?

Antwort im Vorstellungsgespräch

Anonym

15. Okt. 2025

Both StringBuilder and StringBuffer are mutable classes used for creating and modifying strings. The main difference is that StringBuffer is synchronized and thread-safe, which makes it slightly slower. StringBuilder, on the other hand, is not synchronized, so it’s faster and preferred in single-threaded environments.