What is difference between String, StringBuilder and StringBuffer in Java | Sololearn: Learn to code for FREE!
+ 5

What is difference between String, StringBuilder and StringBuffer in Java

4th Nov 2017, 4:18 PM
Raphael Williams
Raphael Williams - avatar
5 Answers
+ 9
Getting a much better link for you: http://www.geeksforgeeks.org/g-fact-27-string-vs-stringbuilder-vs-stringbuffer/ In addition, you'll get the difference between String and StringBuilder here: https://www.sololearn.com/Discuss/792745/?ref=app (edited)
4th Nov 2017, 4:33 PM
Dev - avatar
+ 4
there you go: http://bfy.tw/Eqpu
4th Nov 2017, 4:41 PM
Jeremy - avatar
+ 3
@ jeremy 😋
4th Nov 2017, 5:56 PM
D_Stark - avatar
+ 2
Since String is immutable in java, whenever we do String manipulation like concat, substring etc, it generates a new String and discard the older String for garbage collection. StringBuffer and StringBuilder are mutable objects in java and provide append(), insert(), delete() and substring() methods for String manipulation.
5th Nov 2017, 4:17 AM
Talluri Saisumanth
Talluri Saisumanth - avatar
+ 1
**String is immutable ( once created can not be changed )object . The object created as a String is stored in the Constant String Pool . **StringBuffer StringBuffer is mutable means one can change the value of the object . The object created through StringBuffer is stored in the heap . StringBuffer has the same methods as the StringBuilder , but each method in StringBuffer is synchronized that is StringBuffer is thread safe . **StringBuilder StringBuilder is same as the StringBuffer , that is it stores the object in heap and it can also be modified . The main difference between the StringBuffer and StringBuilder is that StringBuilder is also not thread safe. StringBuilder is fast as it is not thread safe . See More On - <a href="http://crbtech.in/Java-Training/difference-stringbuilder-stringbuffer-java"> String,Stringbuilder and Stringbufeer in detail</a>
20th Nov 2017, 7:04 AM
pranit patil
pranit patil - avatar