Object Class in Java
The Object is the superclass for all classes in java. The object class is present in java.lang package. The object class provides many methods as follows.
public String toString(): This method is used to represent Object in String.
protected Object clone() : This method is used to create a copy of this object and returns the same.
boolean equals(Object obj) : This method is used to compare the object is "equal to" this one or not.
protected void finalize() : This method is always invoked by the garbage collector on an object when it determines that there are no more references to the object.
Class getClass() : This method is used to get the runtime class of this Object.
int hashCode() : This method is used to get the hash code value for the object.
void notifyAll() : This method is used to wake up all threads that are waiting on this object's monitor.
void notify() : This method is used to wakes up only one thread waiting on the object.
void notifyAll() : This method is used to wakes up all threads waiting on the object.
0 Comments