Texts: Read the description of the class hierarchy below. It describes the relationship between four classes named A, B, C, and D.
Class Hierarchy:
class A extends Object
class B extends A
class C extends B
class D extends B
(The diagram looks like this)
A / B / C / D
Now consider this code. It declares some references, and then it has six assignment statements. Some of the assignment statements are illegal because the type of the reference on the left of the assignment would not work for storing the object on the right.
For your answer, rewrite this code (feel free to copy and paste), leaving out any illegal statements:
A a;
B[] bArray;
C c;
D d;
a = new B;
c = new C;
bArray = new B[5];
bArray[4] = new D;
bArray[0] = new A;
Edit View Insert Format Tools Table
12pt v Paragraph v
B 1 U A V
v T2 v