Object
一、源码
public final native Class<?> getClass();
获得运行时的类
public native int hashCode();
获得hash码
public boolean equals(Object obj) {
return (this == obj);
}
判断对象是否相等
protected native Object clone() throws CloneNotSupportedException;
克隆
public String toString() {
return getClass().getName() + "@" + Integer.toHexString(hashCode());
}
字符串形式
public final native void notify(); public final native void notifyAll();
唤醒监视该对象的一个或多个线程
public final native void wait(long timeout) throws InterruptedException;
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);
}
public final void wait() throws InterruptedException {
wait(0);
}
使当前线程等待
protected void finalize() throws Throwable { }
垃圾回收器调用回收对象

浙公网安备 33010602011771号