package inherit;
public class INHERIT {
public static void main(String[] args) {
A superAb = new superAb A();
X subAb= new subAb X();
superAb.i= 10;
superAb.j= 20;
System.out.println("Contents of superab: ");
superAb.showab();
System.out.println();
subAb.a = 7;
subAb.b = 8;
subAb.c = 9;
System.out.println("Contents of subAb: ");
subAb.showAb();
subAb.showc();
System.out.println();
System.out.println("Sum of a, b and c in subAb: ");
subAb.sum();
}
}
我们被告知要对此代码进行故障排除。您能帮我知道是什么问题吗?所述输出应为:
Contents of superab:
a and b: 10 20
Contents of subAb:
a and b: 7 8
c=9
Sum of a, b and c in subAb:
a+b+c: 24