String的又一次探究

178 阅读1分钟

转载自 https://hacpai.com/article/1533720931387#toc_h2_3

https://www.zhihu.com/question/31345592

1.string 是final的,不可变的。对string 的 + 操作,不是原内存地址,而是指向一个新对象,新地址。所以 string + 的操作,推荐使用 stringbuilder 等。

2.