+ 5
What is difference between String, StringBuilder and StringBuffer in Java
5 Réponses
+ 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)
+ 4
there you go: http://bfy.tw/Eqpu
+ 3
@ jeremy 😋
+ 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.
+ 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>