What are the differences between StringBuffer and StringBuilder?


The differences between the StringBuffer and StringBuilder is given below.

No. StringBuffer StringBuilder
1) StringBuffer issynchronized , i.e., thread safe. It means two threads can't call the methods of StringBuffer simultaneously. StringBuilder isnon-synchronized ,i.e., not thread safe. It means two threads can call the methods of StringBuilder simultaneously.
2) StringBuffer isless efficient than StringBuilder. StringBuilder ismore efficient than StringBuffer.
0 answers