3 回答

TA貢獻(xiàn)1995條經(jīng)驗(yàn) 獲得超2個(gè)贊
==
equals
String x = "hello";String y = new String(new char[] { 'h', 'e', 'l', 'l', 'o' });System.out.println(x == y); // falseSystem.out.println(x.equals(y)); // true
String x = "hello";String y = "he" + "llo";System.out.println(x == y); // true!
x
y
y
"hello"
.

TA貢獻(xiàn)1817條經(jīng)驗(yàn) 獲得超6個(gè)贊

TA貢獻(xiàn)1876條經(jīng)驗(yàn) 獲得超7個(gè)贊
myAccount.equals(yourAccount)
是 true
因?yàn)樗麄冇?/trans> 同值
,但是 myAccount == yourAccount
是 false
因?yàn)樗麄儾皇?/trans> 同一帳戶.
Account
添加回答
舉報(bào)