[英]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.