Difference between String Buffer and String Builder

0
14

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
(Visited 5 times, 1 visits today)

LEAVE A REPLY

Please enter your comment!
Please enter your name here