public class StringNote{
?public static void main(String[] args){
??char[] c={'h','e','l','l','o'};
??String str1=new String(c);
??String str2=new String(c);
??String str3="hello";?//常量池中有 “hello” 字符串,str3和str4分別指向他
??String str4="hello";
??String str5=new String("hello"); //該對象是new出來的,因此是在堆內存中而不是常量池中的“hello”字符串
??System.out.println(str1==str2);?//false
??System.out.println(str1==str3);?//false
??System.out.println(str3==str4);?//true
??System.out.println(str4==str5);?//false
?
?}
}