StringBuilder is for creating and manipulating dynamic string,
StringBuilder can store characters specified by its capacity
property.
public class Main { public static void main(String[] args) {// ww w . java 2s. c o m StringBuilder buffer1 = new StringBuilder(); StringBuilder buffer2 = new StringBuilder(10); StringBuilder buffer3 = new StringBuilder("hello"); System.out.printf("buffer1 = \"%s\"\n", buffer1); System.out.printf("buffer2 = \"%s\"\n", buffer2); System.out.printf("buffer3 = \"%s\"\n", buffer3); } }