1 7 8 package java.lang; 9 10 20 public class Object { 21 22 private static native void registerNatives(); 23 static { 24 registerNatives(); 25 } 26 27 38 public final native Class <? extends Object > getClass(); 39 40 75 public native int hashCode(); 76 77 123 public boolean equals(Object obj) { 124 return (this == obj); 125 } 126 127 185 protected native Object clone() throws CloneNotSupportedException ; 186 187 208 public String toString() { 209 return getClass().getName() + "@" + Integer.toHexString(hashCode()); 210 } 211 212 244 public final native void notify(); 245 246 268 public final native void notifyAll(); 269 270 354 public final native void wait(long timeout) throws InterruptedException ; 355 356 418 public final void wait(long timeout, int nanos) throws InterruptedException { 419 if (timeout < 0) { 420 throw new IllegalArgumentException ("timeout value is negative"); 421 } 422 423 if (nanos < 0 || nanos > 999999) { 424 throw new IllegalArgumentException ( 425 "nanosecond timeout value out of range"); 426 } 427 428 if (nanos >= 500000 || (nanos != 0 && timeout == 0)) { 429 timeout++; 430 } 431 432 wait(timeout); 433 } 434 435 473 public final void wait() throws InterruptedException { 474 wait(0); 475 } 476 477 524 protected void finalize() throws Throwable { } 525 } 526 | Popular Tags |