Object Class
Author: Ravi Poswal
Object class(java.lang) is the root of the class hierarchy. Every class has Object as a superclass. This class's methods are implemented by all objects, including arrays.This object's runtime class is returned. The methods defined in the Object class are immediately accessible by all Java classes. toString() method returns a string representation of the object.
Code Example
class Student {
int id;
String name;
}
public class Test {
public static void main(String[] args) {
Student s1 = new Student();
System.out.println(s1.toString());
}
}
RANREV INFOTECH