Difference between String Buffer and String Builder


This tutorial is all about Difference between String Buffer and String Builder.
Subject: In this article we will learn difference between String Buffer and String Builder

String Buffer was introduced in JDK 1.0 and it is synchronized. This means two or more threads cannot execute at a time String Buffer object.

On the other hand, String Builder was introduced in JDK 1.5 and it is non synchronized. Hence, for good performance we should use String Builder during concatenation of Strings.

Similarity between them is both are mutable which helps to avoid creation of multiple String objects in String pool.


Readers might Read also:

Difference between String class and String Buffer/ String Builder class in Java

Facebook Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.