What is difference between String, StringBuilder and StringBuffer in Java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is difference between String, StringBuilder and StringBuffer in Java?

22nd Aug 2018, 4:20 PM
Sophia
4 Answers
+ 3
String is immutable, if you try to alter their values, another object gets created, whereas StringBuffer andStringBuilder are mutable so they can change their values. Thread-SafetyDifference: The difference between StringBuffer and StringBuilder is thatStringBuffer is thread-safe.
22nd Aug 2018, 4:27 PM
Mayur Shedage
Mayur Shedage - avatar
+ 3
Mayur Shedage How is StringBuilder used in writing programs??
22nd Aug 2018, 4:29 PM
Sophia
+ 3
thanks
22nd Aug 2018, 5:58 PM
Sophia
+ 2
please check below link it may help you thanks https://docs.oracle.com/javase/tutorial/java/data/buffers.html
22nd Aug 2018, 4:31 PM
Mayur Shedage
Mayur Shedage - avatar