Java代码
String s1 = new StringBuilder("computer ").append("software").toString();
System.out.println(s1.intern() == s1);
String s2 = new StringBuilder("ja").append("va").toString();
System.out.println(s2.intern() == s2);
在JDK 1.6中,结果是
false
false
但是JDK 1.7,
true
false
你能告诉我原因吗?