首页 > 其他 > 详细

Object

时间:2015-04-23 21:37:56      阅读:370      评论:0      收藏:0      [点我收藏+]

Object类是java最大的超类,也是最底层的类。

  进入Object类中,其中有很多native修饰的方法:

 1     private static native void registerNatives();
 2     static {
 3         registerNatives();
 4     }
 5     public final native Class<?> getClass();
 6     public native int hashCode();
 7     protected native Object clone() throws CloneNotSupportedException;
 8     public final native void notify();
 9     public final native void notifyAll();
10     public final native void wait(long timeout) throws InterruptedException;

  这些方法都是java自身不能实现的,相当于是一个对别的语言的接口(例如:C,C++)。想要深究,首先要清楚JNI的原理和关键字native的作用。

1     public boolean equals(Object obj) {
2         return (this == obj);
3     }

  equals方法是用来比较两个对象的引用是否相同

 

  

 

Object

原文:http://www.cnblogs.com/zuijiu/p/4451748.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!