StringBuffer extends  java.lang. String buffers are safe for use by multiple threads. The methods are synchronized where necessary so that all the operations on any particular instance behave as if they occur in some serial order. The principal operations on a StringBuffer are the append and insert methods, which are overloaded so as to accept data of any type. Each effectively converts a given datum to a string and then appends or inserts the characters of that string to the string buffer.
Every string buffer has a capacity.
As long as the length of the character sequence contained in the string buffer does not exceed the capacity, it is not necessary to allocate a new internal buffer array. If the internal buffer overflows, it is automatically made larger. Constructs a string buffer with no characters in it, and an initial capacity specified by the length argument. If the length argument is less than zero. Constructs a string buffer so that it represents the same sequence of characters as the string argument.