Loading...

Java中Object对象方法

 

1.clone()    复制

2.getClass() 获取对象的class

3.equals() 对象值比较,重写equals方法必须重写hashcode,对象的约定,例如不重写,hashMap的kv不一致;

4.hashCode() 对象的hash值

5.tostring() 默认方法是 包名@改对象的hashCode十六进制表示

6.notify() 线程唤起

7.notifyall() 线程全部唤起

8.wait() 线程等待

9.finalize() 基本没啥用,垃圾回收前调用的方法

 

有空再详解这几个方法的源码;

 

posted @ 2018-11-19 00:23  严康  阅读(5986)  评论(0编辑  收藏  举报