Difference between StringBuilder and StringBuffer class

Explain the difference between StringBuilder and StringBuffer class.

StringBuffer class is contained in java.lang package. This class is mutable means the character string in a string buffer gets changed, but the buffer’s capacity can also change dynamically. StringBuffer is thread safe that means it is synchronized.

JDK1.5 provides another class called StringBuilder, it is same as StingBuffer but it is not thread safe. This is used where the StringBuffer was being used by a single thread. Where possible, it is recommended that this class be used in preference to StringBuffer as it will be faster under most implementations.
What is a StringBuffer class?
In contrast to the String class which implements immutable character strings, the StringBuffer class implements mutable character strings...
What is MAP and SortedMap interface?
A Map is an object that maps keys to values. It is not an extension of the collection interface rather it has own interface hierarchy...
Difference between static and dynamic class loading
Dynamic class loading: This is done by programmatically invoking the functions of a class loader at run time....
Post your comment