6.2.5 The Object class

Previous Index Next 


The Object class is the ancestor class of all the java classes. It has series of useful methods that are available to all java classes. Some of these methods are detailed below. For a full list look at the Java API documentation.
 
 
clone This method creates a copy of a the object that it is called on. 
equals This method compares two objects for equality.
finalize This method is called on an object when the object is garbage collected. A subclass can override finalize so that it can perform clean up before it is destroyed.
hashCode This method returns an unique hash code for the object. This hash code is used by the dictionary type classes.
toString This method returns a string that gives a human readable description of the object.
 



Source