StringBuffer(int capacity) constructor from StringBuffer has the following syntax.
public StringBuffer(int capacity)
In the following code shows how to use StringBuffer.StringBuffer(int capacity) constructor.
public class Main { public static void main(String[] argv) { StringBuffer sb = new StringBuffer(20); System.out.println(sb.capacity()); } }
The output: