1String vs StringBuilder vs StringBuffer
2
3 STRING STRINGBUFFER STRINGBUILDER
4
5Storage String Pool Heap Heap
6Modifiable Immutable Mutable Mutable
7Thread Safe YES YES NO
8Performance FAST VERY SLOW FAST
1The StringBuffer and StringBuilder class both produces mutable string objects.
2 The main difference between them is that StringBuffer is thread safe;
3 StringBuilder is not thread safe.
4
1The main similarity between String and StringBuffer class is that both are
2thread safe.
3The main difference is that String is immutable; StringBuffer is mutable.
4
5
1The StringBuffer and StringBuilder class both produces mutable string objects.
2 The main difference between them is that StringBuffer is thread safe;
3 StringBuilder is not thread safe.
4String is immutable and thread safe.
5We are using StringBuffer when we are doing parallel
6testing since it is a thread safe.
1They both mutable, they are exactly same but
2String buffer is thread safe so it runs slower
3than String builder.
4We are using StringBuffer when we are doing parallel
5testing since it is a thread safe.
1The main similarity between String and StringBuffer class is that both are
2thread safe.
3The main difference is that String is immutable; StringBuffer is mutable.
4