class rom
{
class cd{ cd(int s)
{
}
}
}
public class E8_24 {
class cd1 extends rom.cd
{
cd1(rom j) //为什么这里的参数一定要用rom的对象?
{ j.super(1);
}
}
public static void main(String[] args)
{
rom r=new rom();
rom.cd s=r.new cd(1);
E8_24 E=new E8_24();
E8_24.cd1 c=E.new cd1(r);
}
}
{
class cd{ cd(int s)
{
}
}
}
public class E8_24 {
class cd1 extends rom.cd
{
cd1(rom j) //为什么这里的参数一定要用rom的对象?
{ j.super(1);
}
}
public static void main(String[] args)
{
rom r=new rom();
rom.cd s=r.new cd(1);
E8_24 E=new E8_24();
E8_24.cd1 c=E.new cd1(r);
}
}
类对象调用;应为在你的继承类中要凋class rom 类中的class cd类 的构造方法所以你必须先
new rom类的实例才能在凋class cd的构造;public static void main(String[] args)
{
rom.cd s=r.new cd(1); //代码的位置要倒过来应该就要报错了;
rom r=new rom(); //因为你还没new rom类的实例就凋了cd类的构; E8_24 E=new E8_24();
E8_24.cd1 c=E.new cd1(r);
}