The moose likes Beginning Java and the fly likes question about sub class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "question about sub class" Watch "question about sub class" New topic

question about sub class

John Batista

Joined: May 22, 2011
Posts: 20
my code:

the root class

the node class

the main class

In the screenshot, the x is from the node class, while name() that's run belongs to the root class. what is this inconsistency? Thanks
John Batista

Joined: May 22, 2011
Posts: 20
OK, never mind. after googling, apparently just have to live with that. That's the rule. nothing can be done about it. Thanks
Vishwanath Krishnamurthi
Ranch Hand

Joined: Jun 04, 2007
Posts: 331
Hi John,

Overriding is only for methods. Not for instance fields.

PS: You might find it easier to paste the code and use code tags, than to post screenshots

Pranav Raulkar
Ranch Hand

Joined: Apr 20, 2011
Posts: 73

Hi John,
Similar question has been asked recently by a fellow java rancher. Refer to this post http://www.coderanch.com/t/539683/java/java/inheritance
It is sorta covered in the JavaRanch Style Guide.
subject: question about sub class
Similar Threads
some property CSS in editor not there?
cant find main
question regarding j query grid
something wrong with null exception in I/O processing
jQuery code autocompletion