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