ITSourceCode.com

We Exist to Provide 100% Free Source Code and Tutorials

Custom Search

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.

Facebook Comments

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked *

ITSourceCode.com © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!