java.lang · java.base · since Java 1.0
Object
public class ObjectThe root of the class hierarchy. Every class inherits its identity, equality, hashing, and monitor methods — and overriding them correctly is a contract-bound discipline.
- equals/hashCode/toString are the overridable trio — see the Object Contracts topic
- wait/notify/notifyAll operate on the object monitor (legacy; prefer java.util.concurrent)
- getClass() returns the runtime Class object
Key methods
boolean equals(Object obj) | Reference equality by default; override for value equality (with hashCode). |
int hashCode() | Identity-based by default; must be consistent with equals. |
String toString() | ClassName@hexHash by default; always override for diagnostics. |
Class<?> getClass() | Runtime class, the reflection entry point. |
void wait() / void notify() / void notifyAll() | Monitor coordination — superseded by concurrency utilities. |
protected Object clone() | Field-by-field copy behind Cloneable; broken design, prefer copy constructors (EJ 13). |