top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

Reason behind the Object class

+2 votes
455 views

Why in the Obejct class parent for all classes in Java. what is the reasoning behind this.

posted Jun 23, 2013 by Vikalp Kumar

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

+2 votes

Java chose to make a single class be the ultimate parent class for everything so that there is an easy way to pass around any arbitrary object, without needing to know its type (i.e. you can use the declared type of Object to refer to every single item in the type system, even primitives using their wrapper classes). However, there are OOP languages such as C++ where there is no universal base class as in Java. Another benefit to having a universal base class is that logic dealing with the superclass does not have to be special cased for top-level classes (with the exception of the universal base class, Object, itself).

answer Jun 23, 2013 by Salil Agrawal

Useful Links with Similar Problem
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...