When you have a subclass constructor, and you don't explicitly call a superclass constructor from it, then an implicit call to the no-args constructor of the superclass is inserted. Like in any other class, if there is no constructor in the superclass, then a default no-args constructor will be created. However, if there is already a constructor in the class definition, then a default constructor will not be created.
It's telling you here that it inserted an implicit call to the no-args constructor of the superclass, but there isn't one.
Okay, I put a no arg constructor initializing name to "john doe" and dept to 0, and the code works fine. But how do I get rid of that, because my professor probably will not like it. Thanks :-)
Also, is my overridded hashCode() okay? [ September 22, 2006: Message edited by: Jesse Crockett ]
Well as your code stands, it won't matter if your professor doesn't like it, you have to have the no-args constructor. I would say that your professor would probably want you to reexamine your two class definitions and make use of inheritance. Remember that you can explicitly invoke a constructor from the superclass from the subclass constructor, and non-private variables in the superclass are inherited by the subclass in this case.
I have rewritten the code so the constructor call:
and the variables are protected instead of private
will you look closely at my equals() method in SalariedEmployee class and let me know if i am doing it right? it seems to work, but i'm not sure if it's the right way. thanks again :-)