AbstractStringBuilder 是静态的可变字符序列,是stringBuilder 与 StringBuffer 的父类
属性
/**
* The value is used for character storage.
*/
char[] value;
/**
* The count is the number of characters used.
*/
int count;
/**
* This no-arg constructor is necessary for serialization of subclasses.
*/
本质还是 跟String 一样 值 使用char[]存储 ,但是因为它是可变的 所以 count 的是大小不一定是value数组的大小。
构造器
/**
* This no-arg constructor is necessary for serialization of subclasses.
*/
AbstractStringBuilder() {
}
/**
* Creates an AbstractStringBuilder of the specified capacity.
*/
AbstractStringBuilder(int capacity) {
value = new char[capacity];
}
StringBuffer :线程安全的字符串序列