定义了一个子类 DetailAccount
class DetailAccount extends Acount{
protected String detail;
protected double get_money;
protected double save_money;
public DetailAccount()
{
super();
}
public DetailAccount(int creat_id,String create_name,double create_balance){
//System.out.println("创建客户,请输入客户姓名,初次存款金额");
super.id = creat_id;
super.name = create_name;
super.balance = create_balance;
super.time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
super.time.format(new Date());
super.APR =3.0;
//System.out.println(df.format(new Date()));// new Date()为获取当前系统时间
}//后面的代码省略
}在同一个包的另外一个java文件中,
这样定义了一个二维数组DetailAccount[][] ac = new DetailAccount[50][50];
最后我在赋值的时候,为什么这一句ac[count][0] = new DetailAccount(1,"s",2.00);老报错No enclosing instance of type Acount is accessible. Must qualify the allocation with an enclosing instance of type Acount (e.g. x.new A() where x is an instance of Acount).//Acount是DetailAccount的父类,小子新手,不理解啊
class DetailAccount extends Acount{
protected String detail;
protected double get_money;
protected double save_money;
public DetailAccount()
{
super();
}
public DetailAccount(int creat_id,String create_name,double create_balance){
//System.out.println("创建客户,请输入客户姓名,初次存款金额");
super.id = creat_id;
super.name = create_name;
super.balance = create_balance;
super.time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
super.time.format(new Date());
super.APR =3.0;
//System.out.println(df.format(new Date()));// new Date()为获取当前系统时间
}//后面的代码省略
}在同一个包的另外一个java文件中,
这样定义了一个二维数组DetailAccount[][] ac = new DetailAccount[50][50];
最后我在赋值的时候,为什么这一句ac[count][0] = new DetailAccount(1,"s",2.00);老报错No enclosing instance of type Acount is accessible. Must qualify the allocation with an enclosing instance of type Acount (e.g. x.new A() where x is an instance of Acount).//Acount是DetailAccount的父类,小子新手,不理解啊
您的意思是把DetailAccount[][] ac = new DetailAccount[50][50]; 这一句改为Account[][] ac = new DetailAccount[50][50];??我开始就是这样写的,但是不对啊,一样的报错