主题:新手问题:找不到符号
程序如下:
public class Car{
String color;
String category;
Car(){
color="红色";
category="轿车";
}
Car(String color,String category){
this.color=color;
this.category=category;
}
}
public class Car1 extends Car{
String factory;
Car1(String color,String category,String factory){
super(color,category);
this.factory=factory;
}
Car1(String color){
this.color=color;
category="轿车";
factory="上海大众";
}
Car1(){
Car1("蓝色");
}
public void display()
{
System.out.println(color+","+category+","+factory);
}
public static void main(String args[]){
Car1 c1=new Car1("红色","轿车","广州本田");
Car1 c2=new Car1("黑色");
Car1 c3=new Car1();
c1.display();
c2.display();
c3.display();
}
}
提示错误:Car1.java:16: 找不到符号
符号: 方法 Car1(java.lang.String)
位置: 类 Car1
Car1("蓝色");
麻烦大家看下,我一直不知道哪出错了。
public class Car{
String color;
String category;
Car(){
color="红色";
category="轿车";
}
Car(String color,String category){
this.color=color;
this.category=category;
}
}
public class Car1 extends Car{
String factory;
Car1(String color,String category,String factory){
super(color,category);
this.factory=factory;
}
Car1(String color){
this.color=color;
category="轿车";
factory="上海大众";
}
Car1(){
Car1("蓝色");
}
public void display()
{
System.out.println(color+","+category+","+factory);
}
public static void main(String args[]){
Car1 c1=new Car1("红色","轿车","广州本田");
Car1 c2=new Car1("黑色");
Car1 c3=new Car1();
c1.display();
c2.display();
c3.display();
}
}
提示错误:Car1.java:16: 找不到符号
符号: 方法 Car1(java.lang.String)
位置: 类 Car1
Car1("蓝色");
麻烦大家看下,我一直不知道哪出错了。