Object is a superclass of all other classes. Therefore, Object can refer to an object of any other class. Also, a variable of type Object can also refer to any array.
Object defines the following methods, which means that they are available in every object.
Methods from Object class
|Object||clone( )||Creates a new object that is the same as the object being cloned.|
|boolean||equals(Object object)||Determines whether one object is equal to another.|
|void||finalize( )||Called before an unused object is recycled.|
|Class||getClass( )||Obtains the class of an object at run time.|
|int||hashCode( )||Returns the hash code associated with the invoking object.|
|void||notify( )||Resumes execution of a thread waiting on the invoking object.|
|void||notifyAll( )||Resumes execution of all threads waiting on the invoking object.|
|String||toString( )||Returns a string that describes the object.|
|void||wait( )||Waits on another thread of execution.|
|void||wait(long milliseconds)||Waits on another thread of execution.|
|void||wait(long milliseconds, int nanoseconds)||Waits on another thread of execution.|
getClass( ), notify( ), notifyAll( ), and wait( ) are final.
The equals( ) method compares the contents of two objects.
It returns true if the objects are equivalent, and false otherwise.
The toString( ) method returns a string that contains a description of the object.
toString( ) method is automatically called when an object is output using println( ).
|Copyright 2009 - 12 Demo Source and Support. All rights reserved.|
|All other trademarks are property of their respective owners.|