Name

java.lang.Object

Synopsis

This class is a slightly smaller counterpart to the J2SE Object class. It forms the base of the object hierarchy in Java; in other words, all classes are subclasses of Object. The equals() method tests for a byte-for-byte equivalence between the data of two objects. (Be sure not to confuse this with the == operator, which simply tests if two references point to the same object.) getClass() returns a Class object associated with this object. The three wait() methods, as well as notify() and notifyAll(), are used for thread synchronization on an object. As with any J2SE object, subclasses should override toString() and hashCode() if appropriate (e.g., creating an object that acts as a key in a Hashtable). Finally, note that the finalize() method has been eliminated in the J2ME version of Object.

public classObject {
   // public constructor
   public Object();

   // public instance methods
   public boolean equals(Object obj);
   public final Class getClass();
   public int hashCode();
   public final void notify();
   public final void notifyAll();
   public String toString();
   public final void wait() throws java.lang.InterruptedException;
   public final void wait(long timeout) throws java.lang.InterruptedException;
   public final void wait(long timeout, int nanos) throws
       java.lang.InterruptedException;
}

Get Wireless Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.