1.构造方法
public Object(){
}
2、所有方法
(1)clone()
protected native Object clone() throws CloneNotSupportedException;
创建并返回此对象的副本。
(2)equals(Object obj)
public boolean equals(Object obj) {
return (this == obj);
}
指示一些其他对象是否等于此。
(3)finalize()
protected void finalize() throws Throwable { }
当垃圾收集确定不再有对该对象的引用时,垃圾收集器在对象上调用该对象。
(4)getClass()
public final native Class<?> getClass();
返回此 Object的运行时类。
(5)hashCode()
public native int hashCode();
返回对象的哈希码值。
(6)notify()
public final native void notify();
唤醒正在等待对象监视器的单个线程。
(7)notifyAll()
public final native void notifyAll();
唤醒正在等待对象监视器的所有线程。
(8)toString()
public String toString() {
return getClass().getName() + "@" + Integer.toHexString(hashCode());
}
返回对象的字符串表示形式。
(9)wait()
public final void wait() throws InterruptedException {
wait(0);
}
导致当前线程等待,直到另一个线程调用该对象的 notify()方法或 notifyAll()方法。
(10)wait(long timeout)
public final native void wait(long timeout) throws InterruptedException;
导致当前线程等待,直到另一个线程调用 notify()方法或该对象的 notifyAll()方法,或者指定的时间已过。
(11)wait(long timeout, int nanos)
public final void wait(long timeout, int nanos) throws InterruptedException {
if (timeout < 0) {
throw new IllegalArgumentException("timeout value is negative");
}
if (nanos < 0 || nanos > 999999) {
throw new IllegalArgumentException(
"nanosecond timeout value out of range");
}
if (nanos > 0) {
timeout++;
}
wait(timeout);
}
导致当前线程等待,直到另一个线程调用该对象的 notify()方法或 notifyAll()方法,或者某些其他线程中断当前线程,或一定量的实时时间。