• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

cannot resolve symbol

 
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
Please help, why I am unable to compile this code

thanks
siva
x38020
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry wrong answer
 
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> Whew ... I hope that all makes sense.
Absolutely.
Thanks you very much.
-siva
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic