说明:Java String 为啥是不可变的
最近面试问到String对象为啥不可变?因此打算看看源码一看究竟。
1、先看看源码
public final class String
implements java.io.Serializable, Comparable, CharSequence {
/** The value is used for character storage. */
private final char value[];
/** Cache <weixin_38688906> 上传 | 大小:157kb