Analysis & Answers
The Java Object class is the parent class of all classes, which means that all classes in Java inherit Object, and subclasses can use all methods of Object .
- registerNatives() //Private method
- getClass() //Return the running class of this Object.
- hashCode () //Used to get the hash value of the object.
- equals (Object obj) //Used to confirm whether two objects are "the same".
- clone() //Create and return a copy of this object.
- toString () //Returns the string representation of the object.
- notify() //Wake up a single thread waiting on this object monitor.
- notifyAll() //Wake up all threads waiting on this object monitor.
- wait(long timeout) //Causes the current thread to wait before other threads call the notify() method or notifyAll() method of this object, or the specified amount of time is exceeded.
- wait(long timeout, int nanos) //Cause the current thread to wait until other threads call the notify() method or notifyAll() method of this object, or some other thread interrupts the current thread, or a certain amount of actual time has passed. .
- wait() //Used to make the current thread lose its operation permission and the current thread enters the waiting sequence.
- finalize() //This method is called by the object's garbage collector when the garbage collector determines that there are no more references to the object.
Reflect & Expand
Object methods are available, but they are not necessarily easy to use. People often rewrite some methods to meet business needs.
Meow Interview Assistant: One-stop solution to interview questions. You can search the WeChat applet [Meow Interview Assistant] or follow [Meow Interview Assistant] -> Interview Assistant to answer questions for free. If you have any good interview knowledge or skills, I look forward to sharing them with you!