• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cannot resolve symbol

 
Siva kandasamy
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
Please help, why I am unable to compile this code

thanks
siva
x38020
 
Manoj Zachariah
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the RoundGlyph should be declared abstract
abstract class RoundGlyph_AAA extends RoundGlyph { }

 
Manoj Zachariah
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry wrong answer
 
Wayne L Johnson
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Whew ... I hope that all makes sense.
Absolutely.
Thanks you very much.
-siva
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic