Java Object class

The super class of all classes of Java is Object class. If you do not extend any class to your class, implicitly JRE (Java Runtime Environment) extends Object class. See the following simple class. Let us see more on Java Object class.
Java Object class: You write like this:
public class Demo
{
  // some code
}

Java writes the above class like this:

public class Demo extends Object
{
  // some code
}

Why Java does like this? Java designers thought some methods are useful for every Java program. They put these methods in Object class and implicitly extends this class, so that every class can make use of them. Some classes override these methods in the way it would like, like toString() and equals() etc.

Following link of this same Web site gives all the information of Object class.

Root class – class Object – Methods

Leave a Comment

Your email address will not be published.