好吧,我正在为学校做一份作业,并且设立了我的主类和另一个叫做Transaction的类。在我的主类中,我有:Java构造函数未定义?
Transaction t = new Transaction();
并且事务处理被加下划线:它表示构造函数未定义。为什么?!
Transaction类看起来是这样的:
public class Transaction {
private String customerNumber, fName, lName, custAddress, custCity;
private int custZip, custPhone;
/** Constructor*/
public Transaction(String a, String b, String c, String d, String e, int f, int g){
this.customerNumber = a;
this.fName = b;
this.lName =c;
this.custAddress = d;
this.custCity = e;
}
看起来它应该只是工作,但它只是没有。即使当我将大量变量插入到我在main中创建新Transaction对象的位置时,它仍然表示未定义。有人请帮忙!
看起来你需要阅读至少一些Java 101才能入门。 – 2010-09-11 05:30:35
我建议你也检查你的变量名称。另外,如果你没有使用它们,为什么在构造函数中设置'f'和'g'? – 2014-01-30 22:19:06