- String s1="abc";
- String s2="abc";
- String s3="def";
- String s4="abcdef";
- String s5=(s1+s3).intern();
-
-
-
-
- System.out.println("s1==s2?" + "s1=" + s1 + " s2=" + s2 +","+(s1==s2));
- System.out.println("s4==s5?" + "s4=" + s4 + " s5=" + s5 +","+(s4==s5));
複製代碼- String s1="abc";
- String s2="abc";
- String s3="def";
- String s4="abcdef";
- String s5=(s1+s3);
-
-
-
-
- System.out.println("s1==s2?" + "s1=" + s1 + " s2=" + s2 +","+(s1==s2));
- System.out.println("s4==s5?" + "s4=" + s4 + " s5=" + s5 +","+(s4==s5));
複製代碼 |