Why object class is parent for every class?

Questions by sree.srinu38

Showing Answers 1 - 19 of 19 Answers

fayya

  • Jul 8th, 2007
 

Object is a superclass for every java class because all classes required the
properties of object if you create a class


java.lanag.Object fully classified class name


Because every class is subclass of object you can place user defined objects
in collection frame work classes. if object is not a super class then you cannot
put your object in collection classes ed: they void method signature


public void add(Object 0)


If you are using this method you can place your objects because your class
derived from  object class and also wait notify notify all methods used in
threading and String to String() method you have to override to display object
as string


int hasgCode to get hascode if you override this methods then only you can
add your class in Hash table object, for component oriented programming toString
and hascode must be overrided derived from Object class

  Was this answer useful?  Yes

Every class in the Java system is a descendent (direct or indirect) of the Object class. The Object class defines the basic state and behavior that all objects must have, such as the ability to compare oneself to another object, to convert to a string, to wait on a condition variable, to notify other objects that a condition variable has changed, and to return the object's class.

sampra

  • Feb 14th, 2008
 

Object is a superclass for every java class because all classes required the
properties of object if you create a class

  Was this answer useful?  Yes

java is an object oriented language and in java everything is represented as objects (except for primitives, for programmers ease) and therefore all the classes must inherit the features of an object...... and hence object class is the parent of every class.

vinny

  Was this answer useful?  Yes

yrk_in

  • Oct 21st, 2009
 

Because, Java soft people wanted Hirarichy to maintain.
There should not be 2 base classes, as it leads confusion to the programmar, so every class is child of Object.

  Was this answer useful?  Yes

Because it has methods like useful for all the classes, like wait, notify, notifyall, clone and gc, these methods are common use for all classes.

  Was this answer useful?  Yes

Ajay

  • Sep 12th, 2018
 

The main reason is Inheritance. If you observe the methods in Object class, contains the basic methods that every class should contain and they are very basic features or functionalities that every class should have and support.

Also there are many reasons for that...

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions