StringBuilder源码分析
public final class StringBuilder extends AbstractStringBuilder implements java.io.Serializable, CharSequence { ... }
final修饰不可被继承
abstract class AbstractStringBuilder implements Appendable, CharSequence {
char[] value; ... }
底层是char数组,默认长度是16;长度不够会进行扩容,扩大为原来的2倍 + 2