public class StTest {
public static void main(String[] args) {
String str1 = "hello";
String str2 = "he" + new String("llo");
String str3 = "he" + "llo";
System.out.println(str1 == str2);
System.out.println(str1 == str3);
}
}
结果如下:
false
true