RSS Feed for This PostCurrent Article

Java: StringBuilder vs StringBuffer

StringBuilder is introduced starting JDK 1.5. There are few differences for them

  • StringBuffer is designed to be thread-safe and all public methods in StringBuffer are synchronized. StringBuilder does not handle thread-safety issue and none of its methods is synchronized.
  • StringBuilder has better performance than StringBuffer under most circumstances.

So, use StringBuilder if it is not used by multiple threads.


Trackback URL


RSS Feed for This PostPost a Comment

CAPTCHA Image
Refresh Image
*