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