Object ClassObject 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:
toString()equals()hashCode()getClass()clone() (with conditions)finalize() historicallytoString()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: