Name all methods of class java.lang.Object – Java Interview Review

Name all methods of class java.lang.Object

This question is often used as a way of starting a conversation. Most of the methods can be discussed further in detail, but let’s begin with stating them. First of all, you have to remember the method signatures. Even if you don’t know any details on how each particular method works, you’d at least be able to figure them out based on the signature. Also, it's a nice idea to open the source code and read the javadoc of the class. Let's do it as if it was a real interview, and discuss each method. Here's the list:

public final native Class getClass()
public native int hashCode()
public boolean equals(Object obj)
protected native Object clone() throws CloneNotSupportedException
public String toString()
public final native void notify()
public final native void notifyAll()
public final native void wait(long timeout) throws InterruptedException
public final void wait(long timeout, int nanos) throws InterruptedException
public final void wait() throws InterruptedException
protected void finalize() throws Throwable