Object class

Introduction

Object class has got very prominence in Java programming. In inheritance, it sits at the top of the hierarchy. That is, any Java class, either you write or predefined, should be a subclass of Object class. If you write any class, Java implicitly extends Object class. Why this? Java designers thought that some methods are useful for every Java program. They placed these methods in Object class and extends class Object so that every Java program can make use of them.

To say simply, Object class is the super class of all classes of Java. It is the root class of all classes. Any Java class you write implicitly inherits Object and for this reason it is placed at the top of each class in the hierarchy.

That is the class

public class Test { }

you write, implicitly becomes

public class Test extends Object { }

a subclass of class Object.

The class Object includes only one default constructor and comes with methods like getClass(), hashCode(), clone(), toString(), wait(), notify(), notifyAll() and finalize() etc. wait() and notify() are in synchronization.

Practicing class Object methods is very important to get confidence in coding.

Pass comments and suggestions on this tutorial "class Object" to improve the quality.

1 thought on “Object class”

Leave a Comment

Your email address will not be published.