Wednesday, 22 January 2014

The Object class in java

what are the methods define object in java

The object class:


There is one special class, Object, defined by Java. All other classes are subclasses of Object.That is, Objectis a superclass of all other classes. This means that a reference variable of type Object can refer to an object of any other class. Also, since arrays are implemented as classes,a variable of type Object can also refer to any array.


Object defines the  following Methods,                                   

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( ),void wait(long milliseconds), 
void wait(long milliseconds,int nanoseconds):
  Waits on another thread of execution.



No comments :

Post a Comment