[求助]java中构造函数的错误?
初学JAVA做了个程序public class Fruits{
String name;
int quantity;
double price;
void Fruits(String name1,int quantity1,double price1){
name=name1;
quantity=quantity1;
price=price1;
}
void print (){
System.out.println("水果名称为"+name);
System.out.println("水果数量为"+quantity);
System.out.println("水果价格为"+price);
}
public static void main (String [] args){
Fruits fs= new Fruits("apple",20,1);
fs.print();
}
}
编译时程序总报错
cannot resolve symbol
symbol : constructor Fruits (java.lang.String,int,int)
location: class Fruits
Fruits fs= new Fruits("apple",20,1);
^
1 error
我怎么也找不到错误,这个怎么改才行啊????
[此贴子已经被作者于2006-8-5 16:08:29编辑过]