Java tutorial
public class Main { public static void main(String[] args) { StringBuilder sb = new StringBuilder(200); // Capacity:200, length:0 sb.append("Hello"); // Capacity:200, length:5 int len = sb.length(); // len is assigned 5 int capacity = sb.capacity(); // capacity is assigned 200 } }