aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "question about sub class" Watch "question about sub class" New topic
Author

question about sub class

John Batista
Greenhorn

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
Greenhorn

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


Blog
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
 
 
subject: question about sub class