GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  J2EE  >  Core Java
Go To First  |  Previous Question  |  Next Question 
 Core Java  |  Question 414 of 502    Print  
Why object class is parent for every class?

  
Total Answers and Comments: 6 Last Update: October 22, 2009     Asked by: sree.srinu38 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: sujatham
 
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.

Above answer was rated as good by the following members:
bino75
July 08, 2007 06:51:47   #1  
fayya        

RE: Why object class is parent for every class?

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


 
Is this answer useful? Yes | No
August 03, 2007 05:26:14   #2  
sujatham Member Since: January 2006   Contribution: 142    

RE: Why object class is parent for every class?
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.
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
February 14, 2008 23:57:51   #3  
sampra Member Since: February 2008   Contribution: 278    

RE: Why object class is parent for every class?
Object is a superclass for every java class because all classes required the
properties of object if you create a class

 
Is this answer useful? Yes | No
June 04, 2008 07:01:59   #4  
vinaymudgil007 Member Since: May 2008   Contribution: 43    

RE: Why object class is parent for every class?
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

 
Is this answer useful? Yes | No
October 21, 2009 04:46:54   #5  
yrk_in Member Since: October 2009   Contribution: 2    

RE: Why object class is parent for every class?

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.


 
Is this answer useful? Yes | No
October 22, 2009 01:06:31   #6  
jawaharl0207 Member Since: February 2009   Contribution: 9    

RE: Why object class is parent for every class?
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.
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape