Because EVERY class in Java automatically inherits from Object class.
So these methods:
✔ work on all objects
✔ are used everywhere in APIs
✔ are crucial for debugging, comparison, hashing, collections
The parent of all Java classes.
Everything indirectly extends
Object.
This means methods like:
toString()equals()hashCode()are available in every class — even if you never write them.
When you print an object:
System.out.println(obj);