File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Inheritance problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Inheritance problem" Watch "Inheritance problem" New topic
Author

Inheritance problem

Chaturaka Gunatilaka
Greenhorn

Joined: Oct 06, 2012
Posts: 16


I want to get the output as "Toyota Corolla 2000000 2001".But there is something wrong.What is it?Thank you.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

the problem is shadowing
either explicitly mention super class's variable as in


or

fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 10912
    
  12

Chaturaka Gunatilaka wrote:I want to get the output as "Toyota Corolla 2000000 2001".But there is something wrong.What is it?Thank you.

Generally, to posts like this, I'd reply with "How do you know something is wrong?"

Folk around here aren't mind readers. We don't know what you think is wrong. If I were to compile and run this, I'd take a look and see the code is doing exactly what it is supposed to do. I could GUESS what you think is wrong, but it would only be a guess.

Your job, when you post here, it to make it EASY for us to help you. You may want to look at some of the articles here, especially the one called TellTheDetails.

thanks


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inheritance problem
 
Similar Threads
Can any one explain me this
Casting
DOUBT on DOWNCASTING
Static method can access in a subclass
Please help with JTextArea problem...