62,616
社区成员
发帖
与我相关
我的任务
分享
public static void main(String[] args) {
String s1 = "abc";
String s2 = new String("abc");
String s3 = "a" + "bc";
String s4 = "a" + new String("bc");
System.out.println(s1 == s2); //false
System.out.println(s1 == s3); //true
System.out.println(s1 == s4); //false
System.out.println(s1 == s4.intern()); //true
}