Wednesday, October 26, 2011

Object in Java

In Java, it's the root class. All objects implement the methods of this class.

clone(), creates and returns a copy of the object
equals(Object), tests whether the two objects are equal to each other.
finalize(), garbage collector calls this method when there are no more references to this object
getClass(), returns the runtime class of the Object
hashCode(), hash code value of the Object
toString(), string representation of the Object

Thread related functions:
notify(), notify/awaken a single thread waiting on this object
notifyAll(), notify/awaken all threads waiting on this object
wait(), causes the current thread to wait until another thread invokes notify
wait(timeout), causes the current thread to wait until another thread invokes notify or the timeout is up

No comments:

Post a Comment