The String class is immutable. The StringBuffer class is mutable . String is slow and consumes more memory when we concatenate too many strings because every time it creates new instance. StringBuffer is fast and consumes less memory when we concatenate t strings.
Read moreWhat is the difference String and StringBuffer and StringBuilder?
What are the differences between StringBuffer and StringBuilder? StringBufferStringBuilderStringBuffer is to used when multiple threads are working on the same StringStringBuilder is used in a single-threaded environment.String vs StringBuilder vs StringBuffer in Java | Edureka www.edureka.co › blog › string-vs-stringbuffer-vs-stringbuilder
Read more