本帖最后由 py强子 于 2013-8-15 20:51 编辑
class A
{
private String name;
A(String name)
{
this.name = name;
System.out.println("A");
}
}
class B extends A
{
B(String name)
{
super(name);
System.out.println("B");
}
}
class C extends B
{
C(String name)
{
super(name);
System.out.pritnln("C");
}
}
class ExtendsDemo3
{
public static void main(String[] args)
{
C c = new C("name");
}
}
这就调用的A类的构造方法:
结果为: A B C;
|