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
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