public Demo (String n,String str,int a)
{
this(name,age);
address= ar;
}
public Demo (String n, int a)
{
name = n;
age=a;
}
你的本意是想在构造函数public Demo (String n,String str,int a) 中调用构造函数public Demo (String n, int a) 但是public Demo (String n,String str,int a) 中没有参数name和age.
你可以把 public Demo (String n,String str,int a)
{
this(name,age);
address= ar;
}
改成 public Demo (String n,String str,int a)
{
this(n,a);
address= ar;
}
这样就可以了 |