class A{ public A(){ System.out.println(" String a"); } }class B extends A{public B(){System.out.println("String b");}}class C extends B{public C(){System.out.println("String c");}}public class ConstructorTest{ public static void main(Stringargs[]){C

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/17 19:45:03
class A{ public A(){ System.out.println(
x)KI,.VpV((MLVpЬV,.I/-+(+PR.24jj!R+JRR@F@Mp$Zngn'ngj&}R\X3Sr34 F$GjV;$}$aF 0@h"l3&c3!+!t` y aZb {lޜg3?dg~͈Ot0O,tw?t=|V˳۞6|ņSV<Tl^ˆϦ|y~qAb(|sn

class A{ public A(){ System.out.println(" String a"); } }class B extends A{public B(){System.out.println("String b");}}class C extends B{public C(){System.out.println("String c");}}public class ConstructorTest{ public static void main(Stringargs[]){C
class A{ public A(){ System.out.println(" String a"); } }
class B extends A{
public B(){
System.out.println("String b");
}
}
class C extends B{
public C(){
System.out.println("String c");
}
}
public class ConstructorTest{
public static void main(Stringargs[]){
C c = new C();
}
}
运行结果是什么?

class A{ public A(){ System.out.println(" String a"); } }class B extends A{public B(){System.out.println("String b");}}class C extends B{public C(){System.out.println("String c");}}public class ConstructorTest{ public static void main(Stringargs[]){C
String aString bString c
子类创建实例的时候要调用父类构造方法