- 对本地方法注册
private static native void registerNatives();
- 返回此对象的运行时类
public final native Class<?> getClass();
- 返回对象的哈希码值
public native int hashCode();
- 表示其他对象是否等于此对象
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();
- 导致当前线程等待,直到另一个线程调用 notify()方法或 notifyAll()此对象的方法,或者已经过了指定的时间。
public final native void wait(long timeout) throws InterruptedException;
- 导致当前线程等待,直到另一个线程调用 notify()方法或 notifyAll()此对象的方法,或其他一些线程会中断当前线程或某个线程实时数量已经过去。
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 { }