Posts

Showing posts with the label Object class and it's methods

Object Class and it's methods in Java rcub

Object Class and it's methods in Java There is one special class. Object is a superclass of all other classes. This means that a reference variable of type. Object can refer to an object of any other class. Methods of Object class: 1.Object clone( ) Creates a new object that is the same as the object being cloned. 2.boolean equals(Object object) Determines whether one object is equal to another. Or The equals( ) method compares the contents of two objects. It returns true if the objects are equivalent, and false otherwise. 3.void finalize( ) Called before an unused object is recycled. 4.Class getClass( ) Obtains the class of an object at run time. 5. int hashCode( ) Returns the hash code associated with the invoking object. 6.void notify( ) Resumes execution of a thread waiting on the invoking object. 7.void notifyAll( ) Resumes execution of all threads waiting on the invoking object. 8.String toString( ) Returns a string that describes the object. 9.void wa...