我在netbeans ubuntu java standart项目(测试准备)上编写程序。 当我创建AccountStudent.java我得到错误。java继承问题 - 必须在父类中创建空构造函数
Account.java
public abstract class Account {
protected double _sum;
protected String _owner;
protected static int accountCounter=0;
public Account(String owner){
this._sum=0;
this._owner=owner;
accountCounter++;
}
}
AccountStudent.java - 错误:无法找到符号:构造帐户()
public class AccountStudent extends Account{
}
修正了problem-加空账构造:
Account.java
public abstract class Account {
protected double _sum;
protected String _owner;
protected static int accountCounter=0;
public Account(){
}
public Account(String owner){
this._sum=0;
this._owner=owner;
accountCounter++;
}
}
为什么要我创建,如果已经存在,他是因为他继承Object类的空构造帐户?
感谢
这错误应该被改写,以在有意义 – TheLQ 2010-08-17 23:29:17
@Micheal:有错字错误。公共帐户(字符串所有者){超级(所有者);}应该是公共AccountStudent(字符串所有者){超级(所有者);}。 – Shashi 2010-08-18 15:08:34
@Shashi:谢谢,更正 – 2010-08-18 16:06:16