1. package java.lang;
    2. public class Object {
    3. private static native void registerNatives();
    4. static {
    5. registerNatives();
    6. }
    7. public final native Class<?> getClass();
    8. public native int hashCode();
    9. public boolean equals(Object obj) {
    10. return (this == obj);
    11. }
    12. protected native Object clone() throws CloneNotSupportedException;
    13. public String toString() {
    14. return getClass().getName() + "@" + Integer.toHexString(hashCode());
    15. }
    16. public final native void notify();
    17. public final native void notifyAll();
    18. public final native void wait(long timeout) throws InterruptedException;
    19. public final void wait(long timeout, int nanos) throws InterruptedException {
    20. if (timeout < 0) {
    21. throw new IllegalArgumentException("timeout value is negative");
    22. }
    23. if (nanos < 0 || nanos > 999999) {
    24. throw new IllegalArgumentException(
    25. "nanosecond timeout value out of range");
    26. }
    27. if (nanos > 0) {
    28. timeout++;
    29. }
    30. wait(timeout);
    31. }
    32. public final void wait() throws InterruptedException {
    33. wait(0);
    34. }
    35. protected void finalize() throws Throwable { }