java.lang.Object (JDK 1.0)
This is the root class in Java. All classes are subclasses of Object, and thus all objects can invoke the public and protected methods of this class. equals() tests whether two objects have the same value (i.e., not whether two variables refer to the same object, but whether two distinct objects have byte-for-byte equivalence). For classes that implement the Cloneable interface, clone() makes a byte-for-byte copy of an Object. getClass() returns the Class object associated with any Object, and the notify(), notifyAll(), and wait() methods are used for thread synchronization on a given Object.
A number of these Object methods should be overridden by subclasses of Object. Subclasses should provide their own definition of the toString() method so that they can be used with the string concatenation operator and with the PrintWriter.println() methods. Defining the toString() method for all objects also helps with debugging.
Classes that contain references to other objects may want to override the equals() and clone() methods (for Cloneable objects) so that they recursively call the equals() and clone() methods of the objects referred to within the original object. Some classes, particularly those that override equals(), may also want to override the hashCode() method to provide an appropriate hashcode to be used when storing instances in a Hashtable data structure.
Classes that allocate system resources other than memory (such as file descriptors or windowing system graphic contexts) should override the finalize() method to release these resources when the object is no longer referred to and is about to be garbage collected.
public classObject{ //Default Constructor: public Object()//Public Instance Methodspublic booleanequals(Objectobj); public final native ClassgetClass(); public native inthashCode(); public final native voidnotify(); public final native voidnotifyAll(); public StringtoString(); public final native voidwait(longtimeout) throws InterruptedException; public final voidwait(longtimeout, intnanos) throws InterruptedException; public final voidwait() throws InterruptedException; //Protected Instance Methodsprotected native Objectclone() throws CloneNotSupportedException; protected voidfinalize() throws Throwable; }
Extended By:
Many classes
Passed To:
Many methods
Returned By:
Many methods
Type Of:
Event.arg, Event.target, EventObject.source, Image.UndefinedProperty, Reader.lock, ReplicateScaleFilter.outpixbuf, Vector.elementData, Writer.lock