Object class method in Java?


In Interview room most probable asking question is which is object class method?
basic we all know about object & class. and we all knows. but it's simple question and your using everyday in programming but at time you can't handle. it's very easy question.

Object class Method

1 ) clone() - If you want to create a copy of class so that use close() method. it's return create and return copy of class.

2 ) equals() - Some other object equal to this one. so you can use equals().

3 ) finalize() - called by garbage collector and object when garbage collection determines that there are no more reference to the object. all-ready discuss about finalized() method in my daily post.

4 ) getClass() - return runtime class of the object.

5 ) hashCode() - return the hashcode value of object.

6 ) notify() - weak up a single thread that is waiting on this object monitor.

7 ) notifyAll() - weak up all threads that are waiting on this objects monitor.

8 ) toString() - return a string representation of the object.

9 ) wait() - causes current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object. 

so, this are simple method of object class.

Comments