Differentiate between StringBuffer and StringBuilder in Java programming.

Started by sinelogixtech, November 21, 2017, 05:25:16 AM


Adrian

There are many differences between the two, but the biggest one is StringBuffer is thread safe while the StringBuilder is not. This is why Since Java5 StringBuffer is used more.

12Three

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 .

RH-Calvin

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.
Cheap VPS | $1 VPS Hosting
Cheap Dedicated Servers | Free Setup with IPMI