What is the difference between StringBuilder and StringBuffer? StringBuffer is thread safe, where as StringBuilder is not. In other words, StringBuffer class is synchronized and StringBuilder class is not synchronized.
When an application is to run a single thread using some changes for strings, it is advisable to use StringBuilder. If an application uses multiple threads which are used to perform changes to the strings, it is advisable to use StringBuffer.
|