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 :線程安全的字符串序列