java equals()方法与==的区别

java中Bank a中,a不存值,只存reference(内存地址,指向),因此,

Bank a;
Bank b;
b=a;
这时,b的reference和a一样,也就是说,二者都是引用同一个值了。

==表示,判断二者的reference是否一致;

equals()表示,二者的实际值是否一致。

posted @ 2017-11-27 10:58  JokerJason  阅读(186)  评论(0)    收藏  举报

It's not who you are underneath, it's what you do that defines you

Brick walls are there for a reason :they let us prove how badly we want things