|
The standard class Object is a superclass of all other classes.
-A variable of type Object can hold a reference to any object, whether it is an instance of a class or an array.
-All class and array types inherit the methods of class Object.
-The methods of Object are as follows:
o The method getClass returns the Class object that represents the class of the object. A Class object exists for each reference type. It can be used, for example, to discover the fully qualified name of a class, its members, its immediate superclass, and any interfaces that it implements.
o The method toString returns a String representation of the object.
o The methods equals and hashCode are declared for the benefit of hashtables such as java.util.Hashtable. The method equals defines a notion of object equality, which is bosed on value, not reference, comparison.
o The method clone is used to make a duplicate of an object.
o The methods wait, notify and notifyAll are used in concurrent programming using threads.
o The method finalize is run just before an object is destroyed.
|