Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble instantiating a class object

Status
Not open for further replies.

jisoo22

Programmer
Apr 30, 2001
277
US
Hello all,

I think I need another pair of eyes for this because I just don't see why the error is coming up. Here's the setup...I have a driver class that initiated the whole process. There are 4 other java files in a package. One java file in that package basically runs the show by doing all the logical thinking for the simple program (called "trip.java"). The problem is that the trip class needs to instantiate an object of one of the other classes in the java files (called the "fleet class" in this case). The statement I have used is the same thing I've used for other projects and have no problem. It goes as follows:

fleet fl = new fleet();

I get the following error from this:

java:18: cannot resolve symbol
symbol : class fleet
location: class tripSpec.trip
public fleet fl = new fleet();


The fleet class file itself it very simple, with just a few getter and setter methods inside. Am I missing something?

Thanks,
Jisoo22
 
If you split the line that gives the error in 2 lines :
Code:
public fleet fl;
fl = new fleet();
then you know whether he can't find the class (a.), or can't find the constructor (b.).

a. Check your classpath
b. Does your fleet class have one or more constructors but not a constructor without any argument ?
 
I think I figured it out, it was some sort of scope problem =)

Thanks!
Jisoo22
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top