Class Object is the root of the class hierarchy. Every class has Object as super class. All objects, include array, implement the methods of this class.
Object类是所有类的父类,提供了Java所有类的基础方法。
初始化构造:
Object()
提供的其他方法:
Modifier and Type | Method | Description |
Project Object | clone() | 创建并返回这个对象的复制体 |
boolen | equal() | 比较对象是否相等 |
Protect void | finalize() | 结束这个线程 |
Class<?> | getClass() | 得到当前对象的 class |
int | hashCode() | 返回当前对象的哈希码 |
void | notify() | 唤醒线程 |
voide | notifyAll() | 唤醒所有线程 |
String | toString() | 返回这个类型的String对象 |
void | wait() | 使线程沉睡,进入阻塞态 |
void | wait(long timeoutMillis) | 使线程沉睡直到被唤醒或者设置的时间到 |
void | wai(long timeoutMills,int nanos) | 同上 |
这些就是在JAVA中的基础类Object类中定义的方法,这些方法所有的对象都可以调用,但部分类对里面的方法进行了重载,比如String类就对equal方法进行了重载。