Interview Question

What is the parent class of all classes in Java?

Every ordinary Java class ultimately derives from java.lang.Object.

💡 Concept ✅ Quick Revision ☕ Java

Answer

java.lang.Object is the direct or indirect superclass of every class that has no other explicit root. • A class without an extends clause implicitly extends Object, except Object itself. • Object declares methods such as equals, hashCode, toString, getClass, wait, and notify. • Interfaces do not themselves extend Object.

Example

Code
Object value = new String("Java");
System.out.println(value.getClass().getSimpleName());
Output
String

Quick Revision

Every ordinary Java class ultimately derives from java.lang.Object.