Java tutorial
/* * Output: Length: 0 Capacity:40 * */ public class MainClass { public static void main(String args[]) { StringBuffer sb = new StringBuffer(40); System.out.println(sb); System.out.println("Length: " + sb.length()); System.out.println("Capacity:" + sb.capacity()); } }