Ada*_*ski 15
从API文档:
Unless an explicit copy of original is needed, use of this constructor is
unnecessary since Strings are immutable.
Run Code Online (Sandbox Code Playgroud)
我能想到的唯一原因是:
String:A.substring你会看到它引用与原始字符串相同的char []数组.StringA已超出范围,您希望减少内存消耗.char[].允许B超出范围将允许垃圾收集器回收返回char[]A和B 的大型,仅留下小的char[]后备B'.| 归档时间: |
|
| 查看次数: |
3779 次 |
| 最近记录: |