The moose likes Java in General and the fly likes how every java program extends Object class by default Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "how every java program extends Object class by default" Watch "how every java program extends Object class by default" New topic
Author

how every java program extends Object class by default

S.Reddisekhar Reddy
Greenhorn

Joined: Jan 05, 2012
Posts: 10
how every java program extends Object class by default
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 3143
Because the JLS is written that way and compilers are written to implement the JLS.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 8428

I am going to hire you as a painter. There is a clause in the contract that says "If I don't tell you what color to paint a room, paint it beige".

I then say "Go paint my bedroom red, my kitchen green. Also paint the playroom and bathroom."

You know that even though I don't explicitly say what color to paint the last two rooms, you should paint it beige.

The compiler knows that if you don't explicitly state "extends <whatever>", the class should extend the Object class.


Never ascribe to malice that which can be adequately explained by stupidity.
 
IntelliJ Java IDE
 
subject: how every java program extends Object class by default
 
Threads others viewed
Java Inheritance
Sub Class
java inheritance
Java extends Object,SuperClass?
every java class inherits object?
jQuery in Action, 2nd edition