Java's Object class and common methods
The Object class is the root parent class of all classes in Java, and all classes in Java directly or indirectly inherit the Object class.
Method name | Features |
---|---|
clone() | Object clone, rarely used |
equals() | Determine whether the contents of two classes are equal |
finalize() | This method is executed when the object is reclaimed by the garbage collector. The execution time is uncertain, because the garbage collector reclaims the time of this class is uncertain, generally not used |
getClass() | Returns the runtime class of the object (it can be simply understood as the bytecode file of the object's class) |
hashCode() | Returns the hash value of the object |
notify() | Used to wake up waiting threads |
notifyAll() | Wake up all waiting threads |
toString() | Convert object to string |
wait() | In multithreading, let the thread wait |