This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Can't resolve symbol in inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Can Watch "Can New topic

Can't resolve symbol in inheritance

Dan Taylor

Joined: Apr 16, 2004
Posts: 10
I don't understand why I get a can't resolve symbol on my constructors.
Here is the basics of my code
3 classes -
1st class 'A' is abstract
has a default empty constructor and a constructor with A's attributes
public A( int getX )
{ this.x = getX; }

2nd class B extends A
and has default empty constructor (with a call to super()) and a constructor that calls A's constructor and adds B's attributes
public B( int getX, int getY)
super( getX );
this.y = getY;
OK so far so good, these files with their attributes and methods compile.
Now I add class 'C'.
I follow the same format as above creating 2 constructors, a default calling super(); and another that takes the B constructor and adds C's attributes.
When I try to compile I get the following error:

I also get this error on the second constructor. I don't understand why this is happening. Any help would be appreciated.
chi Lin
Ranch Hand

Joined: Aug 24, 2001
Posts: 348
post your code so we can get the whole picture.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24190

Check your definition of the no-argument constructor. Did you accidentally give it a return value, making it into an ordinary method?

[Jess in Action][AskingGoodQuestions]
Dan Taylor

Joined: Apr 16, 2004
Posts: 10
OK the classes A and B were defined by my teacher. They are actually classes Person and Employee. Someone else has posted in this forum from my class so I wanted to avoid posting code. The class I defined is SalesEmployee.
Below is the Person class (the comments are from the teacher to the class):

Here is the teacher defined Employee class with her comments:

Lastly this is my code for SalesEmployee class:

Thanks all
Dan Taylor

Joined: Apr 16, 2004
Posts: 10
Any takers on this one? Please??
chi Lin
Ranch Hand

Joined: Aug 24, 2001
Posts: 348
i try the code, it seems ok to me except the
Company variable was rejected by compiler.
Gary Down
Ranch Hand

Joined: Apr 09, 2004
Posts: 46
I had no problems compiling your code.. had to create a dummy "Company" class.
Suggest you ensure that the .class files are in sync with your .java files
try compiling them again from the top down i.e. person first
Good luck.
Have you checked out Aspose?
subject: Can't resolve symbol in inheritance
It's not a secret anymore!