字符串常量池
2021-12-19 14:48:13 3 举报
jdk1.7后的字符串常量池
作者其他创作
大纲/内容
String hello3 = hello2.intern();
JDK 1.7+
String hello3 = hello2.intern();
hello
字符串常量池
堆
。。。
llo
String hello5 = hello4.intern();
String he = \"llo\";
he
String hello = \"hello\";
String he = \"he\";
String hello = \"hello\";
String hello2 = new String(\"hello\");
String hello2 = new String(\"he\") + new String(\"llo\"); => new StringBuilder().append(\"he\").append(\"llo\").toString();
String hello4 = new String(\"hello\");
收藏
收藏
0 条评论
下一页