0 votes
in JAVA by
What are the differences between StringBuffer and StringBuilder?

1 Answer

0 votes
by

The differences between the StringBuffer and StringBuilder is given below.

No. StringBuffer

1) StringBuffer is synchronized, i.e., thread safe. It means two threads can't call the methods of StringBuffer simultaneously.

2) StringBuffer is less efficient than StringBuilder.

StringBuilder:

  1. StringBuilder is non-synchronized,i.e., not thread safe. It means two threads can call the methods of StringBuilder simultaneously.
  2. StringBuilder is more efficient than StringBuffer.

Related questions

0 votes
asked Sep 18, 2023 in Dot Net by Robin
0 votes
asked Oct 11, 2020 in JAVA by SakshiSharma
...