Strings are constant; their values cannot be changed after they
* are created. String buffers support mutable strings.
* Because String objects are immutable they can be shared.
不可变所以可以共享,线程安全两个好处。因为字符串是最基础的类,会大量重复,所以才设计成不可变的。
Strings are constant; their values cannot be changed after they
* are created. String buffers support mutable strings.
* Because String objects are immutable they can be shared.
不可变所以可以共享,线程安全两个好处。因为字符串是最基础的类,会大量重复,所以才设计成不可变的。