1. Object Class

Object is the root class of Java's class hierarchy.

Every Java class directly or indirectly extends Object.

class Student {
}

Conceptually:

class Student extends Object {
}

So every object gets methods such as:


2. toString()

toString() returns a String representation of an object.

Student s = new Student();
System.out.println(s.toString());

If you don't override it, you generally get a representation containing the class name and hash-related information.

Usually we override it to make objects readable: