@Test
public void test3(){
String s = new String("1");
s.intern();
String s2 = "1";
System.out.println(s == s2);
}
@Test
public void test1(){
String str2 = new String("str")+new String("01");
str2.intern();
String str1 = "str01";
System.out.println(str2==str1);
}
请问同在jdk1.7,为什么两个的结果不一样啊
public void test3(){
String s = new String("1");
s.intern();
String s2 = "1";
System.out.println(s == s2);
}
@Test
public void test1(){
String str2 = new String("str")+new String("01");
str2.intern();
String str1 = "str01";
System.out.println(str2==str1);
}
请问同在jdk1.7,为什么两个的结果不一样啊
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货