標題:
== 跟 s.equals()
[打印本頁]
作者:
buy
時間:
2010-10-16 16:06
標題:
== 跟 s.equals()
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));
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2