Class Object is the root of the classhierarchy. Every classhas Object as a superclass. All objects, including arrays, implement the methods of thisclass.
1.根类Object到底有多少个方法:?
通过JavaSE1.8源码可知是11个!!(看源码很重要)
分别是:
clone():复制与返回一个相同的对象
equals(Object obj):指示是否有其他对象与此对象“相等”。
finalize():当垃圾回收确定不再有对对象的引用时,由对象上的垃圾回收器调用。
getClass():返回并得到该类的基类
public class getClass {
public static void main (String[] args){
Number a = 0;
Class<? extends Number> c = a.getClass();
System.out.println(c);
}
引用JAVASE源码的解释:Class Object is the root of the class hierarchy. Every class has Object as a superclass. All objects, including arrays, implement the methods of this class.1.根类Object到底有多少个方法:?通过JavaSE1.8源码可知是11个!!(看源码很重要)分别是:clone():复制与返回一个相同的对象equal