In StringBuffer class we can create the flexible strings. Means we can easily increase the length of a string if we required, which we cannot do in the String class.
Some of the StringBuffer methods are as follows:
methods working
str.setLength(len) sets the length of the string as specified.
charAt(int location) value at the specified location is obtained using this method.
setCharAt(int location, char c) it sets the single character in StringBuffer at specified location.