There is one special class object defined by java , All other classes are subclasses of object ,That is object is a superclass of all other classes .This means that a reference variable type object can refer to an object of any other class .Also since array are implemented as classes a variable of type object can also refer to any array
Object defines the following a method ,which means that they are available in every object
Object defines the following a method ,which means that they are available in every object
Method
|
Purpose
|
Object clone() | creates a new object that is the same as the object cloned |
boolean euals(Object obj) | Determines whether one object is equal to another |
void finalize() | called before an unused object is recyled |
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() | This method wakes up all threads that are waiting on this object's monitor. |
String toString() | This method returns a string representation of the object. |
void wait() | This method causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object. |
void wait(long timeout) | This method causes the current thread to wait until either another thread invokes the notify() method or the notifyAll() method for this object, or a specified amount of time has elapsed. |
void wait(long timeout, int nanos) | This method causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed. |
0 comments:
Post a Comment