[英]Cannot find symbol in intellij Idea
汽车.java文件
public class Car {
String model;
int year;
int price;
String color;
public Car(String model, int year, int price, String color) {
this.model = model;
this.year = year;
this.price = price;
this.color = color;
}
@Override
public String toString() {
return "Car{" +
"model='" + model + '\'' +
", year=" + year +
", price=" + price +
", color='" + color + '\'' +
'}';
}
}
CarManager.java 文件
public class CarManager {
public static void main(String[] args) {
Car bmw = new Car("m5", 2020, 50000, "black");
Car rr = new Car("sport", 2019, 70000, "white");
System.out.println(bmw);
System.out.println(rr);
}
}
错误:
error: compilation failed CarManager.java:7: error: cannot find symbol Car bmw = new Car("m5", 2020, 50000, "black"); ^ symbol: class Car location: class CarManager CarManager.java:7: error: cannot find symbol Car bmw = new Car("m5", 2020, 50000, "black"); ^ symbol: class Car location: class CarManager CarManager.java:8: error: cannot find symbol. Error cannot find symbol.
您认为问题可能来自 IDEA 吗?
这里有 2 个可能的选项可以使此代码正常工作。
或者
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.