The Artima Developer Community
Sponsored Link

Java Answers Forum
why is Object the root class

1 reply on 1 page. Most recent reply: Dec 9, 2004 12:40 AM by Matthias Neumair

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Neelesh

Posts: 1
Nickname: neeleshmb
Registered: Dec, 2004

why is Object the root class Posted: Dec 8, 2004 3:23 AM
Reply to this message Reply
Advertisement
Hello, i am very new to Java, started just a couple of days before, I wanted to know why is the java.lang.Object class is the root class of all classes, is it something to do with polymorphism?


Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: why is Object the root class Posted: Dec 9, 2004 12:40 AM
Reply to this message Reply
Âll java classes must have SOMETHING in common in order to use them.

Object is the most simple of all classes. It practically defines a couple of simple methods to handle a object of any kind.

Just for an example look at the class Vector.

You can add objects of any class to it. The reason is that every class is a subclass of Object. Otherwise, it would not be possible to compile the code.

Flat View: This topic has 1 reply on 1 page
Topic: Help on Java Event !! Previous Topic   Next Topic Topic: Data Access Layer in java (open source)

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use