String model;
int year;
enum Color {GREEN, BLUE, RED};
double price; 色调;
public Car(String model, int year, Color shade, double price) {
this.model = model;
this.year = year;
this.shade= shade;
this.price = price;
}这样可以吗?当我实际使用main方法创建对象时,仍然会给出错误。
发布于 2017-11-25 21:15:08
enum Color {GREEN, BLUE, RED} ;
public class Car{
String m_model;
int m_year;
Color m_color;
double m_price;
public Car(String model, int year, Color shade, double price) {
this.m_model = model;
this.m_year = year;
this.m_color = shade;
this.m_price = price;
System.out.println("A new Car has been created!");
}
static public void main(String[] args)
{
Car car = new Car("Ferrari", 2017, Color.RED, 350000);
}
}https://stackoverflow.com/questions/47486100
复制相似问题