This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Constructor Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Constructor Problem" Watch "Constructor Problem" New topic
Author

Constructor Problem

Debra Simeroth
Ranch Hand

Joined: Jun 11, 2009
Posts: 33

New problem same program...

I am trying to write a constructor that will refer to another class that I have written. I must be missing something major in the book, which is hard to understand anyway. I get the error "cannot find symbol--constructor employee". As far as I can tell, I am writing the constructor, and have no idea what this error means. Help

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18507
    
  40

I get the error "cannot find symbol--constructor employee". As far as I can tell, I am writing the constructor, and have no idea what this error means. Help



You are listing the code to the PayrollTest class. You need to show us the code for the Employee class -- for us to tell if what issue you are having with the constructor of that class.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Debra Simeroth
Ranch Hand

Joined: Jun 11, 2009
Posts: 33
Here is the code for the employee class


Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18507
    
  40

Basically, here is the code that you are using to construct an employee object... Notice that you are not passing any parameters...



And here is the code -- for all the constructors in the Employee class...



Do you happen to notice any constructors that don't take any parameters?

Henry
Debra Simeroth
Ranch Hand

Joined: Jun 11, 2009
Posts: 33
Thank you... when you asked the question, I found the answer...
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Precisely, default constructor will be there, for your service, in the absence of any kind of constructor. Otherwise, you will not get the default constructor once you define any other constructor of that class.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Constructor Problem
 
Similar Threads
java:12: cannot find symbol
Wildcard Type with Extend - Generics