GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes cannot resolve symbol Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "cannot resolve symbol" Watch "cannot resolve symbol" New topic
Author

cannot resolve symbol

Siva kandasamy
Ranch Hand

Joined: Dec 31, 2002
Posts: 139
Hi there,
Please help, why I am unable to compile this code

thanks
siva
x38020
Manoj Zachariah
Ranch Hand

Joined: Dec 08, 2003
Posts: 65
the RoundGlyph should be declared abstract
abstract class RoundGlyph_AAA extends RoundGlyph { }

Manoj Zachariah
Ranch Hand

Joined: Dec 08, 2003
Posts: 65
sorry wrong answer
Wayne L Johnson
Ranch Hand

Joined: Sep 03, 2003
Posts: 399
The problem has to do with constructors. Remember that Java requires ALL classes to have at least one constructor. If you don't define one, then Java will create a default constructor for you. And the first thing that every constructor does is invoke another constructor. If you don't explicitly invoke another constructor, Java will add a call to "super()". Finally, recall that constructors aren't inherited.
OK, with that said, look at the class:

By applying the above rules, Java converts this to:

It has created a default constructor which invokes the default parent constructor. But the parent class, "RoundGlyph", doesn't have a default constructor. So you get a cryptic error message when you try and compile it.
Either you have to create a default constructor in the "RoundGlyph" class, or you have to create a constructor in the "RoundGlyph_AAA" class which invokes the "super(int)" constructor.
[NOTE: Java doesn't make these changes to the source code, but will insert the changes into the ".class" file on successful compilation.]
Whew ... I hope that all makes sense.
[ December 11, 2003: Message edited by: Wayne L Johnson ]
Siva kandasamy
Ranch Hand

Joined: Dec 31, 2002
Posts: 139
> Whew ... I hope that all makes sense.
Absolutely.
Thanks you very much.
-siva
 
GeeCON Prague 2014
 
subject: cannot resolve symbol