您的位置:首页 > 移动开发 > Objective-C

java-se object

2017-07-29 08:11 417 查看
object 是 java 基类;

object 有clone, hashcode,equals,notify,notifyall, wait 等方法

以下 讨论默认提供的方法,重写的方法 pass;

clone :a native function,u can't use directly;direct use will clone a object from super class; and throw out CloneNotSupportedException

u need  implements Clonenable interface, it will be work fine;

hashcode : default return is memory address;

collection applying this feature, to store the elements;first calculate hash-code and set it to the addr(hash-code address);

 equals: checking object address whether equal;(== is checking param equal and equals func is checking object )

more simply -> equals compare the object contents , == compare object memory address;

the relation between hashcode and equals;

if 2 object equals it has same hashcode;

if 2 object not equals it is also can have same hashcode (case: hash conflict)

wait,notify,notifyall :thread operating function, wait will give up the thread lock,

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  java-se for intervie