Inheritance Google
Inheritance Google
Chapter 8: Inheritance
Note: Java does not support the inheritance of multiple superclasses into a
single subclass
class UseSuper {
public static void main(String args[]) {
B subOb = new B(1, 2);
subOb.show();
}
}
NOTE: instance variable i in B hides the i in A, super allows access to the I defined in the superclass
OUTPUT
Volume of shipment1 is 3000.0
Weight of shipment1 is 10.0
Shipping cost: $3.41
Volume of shipment2 is 24.0
Weight of shipment2 is 0.76
Shipping cost: $1.28