JAVA compiler can't find class file in the same folder...
Posted: Mon Oct 03, 2005 4:52 pm
-----A file called Car.java has the following lines-----
class Car{
int price, year;
public Car(int p, int y){
price = p;
year = y;
}
public int getPrice(){
return price;
}
public int getYear(){
return year;
}
}
-----And another file called testCar.java contains main method, -----
public class testCar{
public static void main(String[] args){
Car c = new Car(2000,1993);
System.out.println(c.getPrice());
}
}
-----No problem in compiling Car.java. However, it gives me the following
-----errors when compiling testCar.java-----
cannot resolve symbol
symbol : class Car
location: class testCar
Car c = new Car(2000,1993);
^
D:\Documents and Settings\yangxingdong\Desktop\testJava\testCar.java:3: cannot resolve symbol
symbol : class Car
location: class testCar
Car c = new Car(2000,1993);
^
2 errors
Tool completed with exit code 1
-----Anyone has idea how to solve the problem? -----
class Car{
int price, year;
public Car(int p, int y){
price = p;
year = y;
}
public int getPrice(){
return price;
}
public int getYear(){
return year;
}
}
-----And another file called testCar.java contains main method, -----
public class testCar{
public static void main(String[] args){
Car c = new Car(2000,1993);
System.out.println(c.getPrice());
}
}
-----No problem in compiling Car.java. However, it gives me the following
-----errors when compiling testCar.java-----
cannot resolve symbol
symbol : class Car
location: class testCar
Car c = new Car(2000,1993);
^
D:\Documents and Settings\yangxingdong\Desktop\testJava\testCar.java:3: cannot resolve symbol
symbol : class Car
location: class testCar
Car c = new Car(2000,1993);
^
2 errors
Tool completed with exit code 1
-----Anyone has idea how to solve the problem? -----