提交 3f6eb7bf 编写于 作者: K Kou Shuang

Update Java内存区域.md

上级 b1bd3bfb
......@@ -317,7 +317,7 @@ System.out.println(str2==str3);//false
System.out.println(str3 == str5);//true
System.out.println(str4 == str5);//false
```
![](https://my-blog-to-use.oss-cn-beijing.aliyuncs.com/2019-6/字符串拼接.png)
![字符串拼接](https://my-blog-to-use.oss-cn-beijing.aliyuncs.com/2019-7/字符串拼接-常量池2.png)
尽量避免多个字符串拼接,因为这样会重新创建对象。如果需要改变字符串的话,可以使用 StringBuilder 或者 StringBuffer。
### 4.2 String s1 = new String("abc");这句话创建了几个字符串对象?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册