Category:
JAVA STRING INTERVIEW QUESTIONS AND ANSWERS
Answer :
The basic difference between StringBuffer and StringBuilder is Thread safety and Synchronization .
StringBuffer is Synchronized and thread-safe due to which multiple threads can safely use it . While StringBuilder is not Synchronized and so not thread-safe .
StringBuffer is slower due to synchronization overhead. Whereas StringBuilder is fast as it avoids locking mechanisms .
