String, StringBuffer and String Builder are classes in Java. String is widely used in Java programming. Once an object of String is created, it is not possible to change them. Each time a change occurs to the String, it creates a new String. Even if it is a concatenation to an existing String it creates a new String. This causes memory wastage. StringBuffer and StringBuilder classes in Java are used to modify String. The key difference between String, StringBuffer and StringBuilder in Java is that String is a class to create an object of type String that is a sequence of characters, StringBuffer is a class that is used to modify Strings that provides thread safety, and StringBuilder is a class that is used to modify Strings that do not provide thread safety.
CONTENTS
1. Overview and Key Difference
2. What is String in Java
3. What is StringBuffer in Java
4. What is StringBuilder in Java
5. Similarities Between String StringBuffer and StringBuilder in Java
6. Side by Side Comparison – String vs StringBuffer vs StringBuilder in Java in Tabular Form
7. Summary