The Object class is the highest level superclass of Java. It contains the following methods that may be overridden in the subclass:
- clone() - Used to make other objects of the same type. The object must be cloneable meaning it must implement the "Cloneable" interface and override the clone method. This method throws a CloneNotSupported Exception.
- equals() - Used to compare two objects to see if they are the same object value.
- finalize() - Used to clean up after a specific object. It is normally overridden by subclass objects to perform specific finilization functions before the object is destroyed.
- toString() - A string representation of the object is returned.
The following methods are final and cannot be overridden:
- getClass() - Gets the Class object runtime representation.
- wait() - There are three versions of this method.
There is a class named "Class". Using the getClass Object class method above will return the Class object which supports the following methods: