Most common java interview question for fresher’s and experienced

What are all the methods available in object class?
java.lang.Object provides a number of methods that are common to all objects. toString() is the most common such method. Since the default toString() method only produces the name of the class, you should override it in all classes you define.
  • public Object()
  • public final Class getClass()
  • public int hashCode()
  • public boolean equals(Object obj)
  • protected Object clone() throws CloneNotSupportedException
  • public String toString()
  • public final void notify()
  • public final void notifyAll()
  • public final void wait(long timeout) throws InterruptedException
  • public final void wait(long timeout, int nanoseconds) throws InterruptedException
  • public final void wait() throws InterruptedException
  • protected void finalize() throws Throwable



EmoticonEmoticon