Warning!New windows update come out.

Monday, April 13, 2009

Java problem: cannot find symbol?

I'm trying to write a Java program that uses several classes. I have a class called Salaried, which is extending Employee. Here is the problem I get:





Salaried.java:18: cannot find symbol


symbol : constructor Employee()


location: class Employee


{


^





The line of code that is having this problem is this:





public Salaried(String name, String street, String city, double salary)


{


It is pointing at that brace and saying it cannot find symbol in the constructor Empolyee, which has a symbol that looks like this:





public Employee(String name, String street, String city)


{


I can't figure out why it is saying cannot find symbol, so any help or advice you can give me is greatly appreciated!



apparently, your trying to make create a new employee using





new Employee()





and its telling you that constructor is not defined. If you have a constructor with arguments, then you must use it:





new Employee(null, null, null, 0);





or add a no-arg constructor

No comments:

Post a Comment

Help on computer for you