一、成员变量
(1)@Stable//表示安全,该字段不会为null。
private final byte[] value;//字节数组保存字符串的值
(2) /** Cache the hash code for the string */
private int hash; // Default to 0
(3)private final byte coder; // 编码,区分拉丁和非拉丁语系
说明:当字符串是静态常量时,该字段会被隐藏。
二、构造函数
说明:因为字符串是不可变得,除非明确需要初始化,否则没必要调用这些构造方法。
(1)空字符串,空字符串没有hash字段。
public String() {
this.value = "".value;
this.coder = "".coder;
}
(1)指定字符串。
public String(String original) {
this.value = original.value;
this.coder = original.coder;
this.hash = original.hash;
}