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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strange .. couldnt find classes on the same folder of main-class

Status
Not open for further replies.

sophie24

Programmer
Jan 20, 2002
20
0
0
CH
i have some code like this:
public class Car {

private static double sprit = 0.0;
private Motor motor = new Motor();
public boolean isReserve = true;

public Car() {
sprit = sprit;
}

public void drive() {
motor.drive();
}

public void tankup(double sprit) {
this.sprit += sprit;
if (this.sprit <= 7)
isReserve = true;
else
isReserve = false;
}

class Motor {
public void drive() {
sprit -=5;
if (sprit <= 7)
isReserve = true;
else
isReserve = false;
}
}

}

and a main program:
public class Test1 {

public static void main(String[] args) {

Auto pkw = new Auto();

System.out.println(pkw.isReserve);
pkw.tanken(10);
System.out.println(pkw.isReserve);
pkw.fahren();
System.out.println(pkw.isReserve);

}
}

but when i compile the class Car could be created but compiling Test1.java gives me the error
cannot resolve symbol class Car location Test1

very strange for me .. thanks for every help and usefull tip
regards
 
please use Car instead of Auto (i had forget to change it)
.. both classes are in the same folder.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top