Question: Given the following type and reference declarations, which assignment is legal? Select the one correct answer. (a) obj2 = obj1; (b) obj3 = obj1; (c)

Given the following type and reference declarations, which assignment is legal?

// Type declarations: interface Il {} interface 12 {} class C1 implements

Select the one correct answer.

(a) obj2 = obj1;

(b) obj3 = obj1;

(c) obj3 = obj2;

(d) I1 a = obj2;

(e) I1 b = obj3;

(f) I2 c = obj1;

// Type declarations: interface Il {} interface 12 {} class C1 implements I1 {} class C2 implements 12 {} class C3 extends C1 implements 12 {} // Reference declarations: C1 obj1 = null; C2 obj2 = null; C3 obj3 = null;

Step by Step Solution

3.41 Rating (148 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

e Only the assignment I1 b obj3 is valid The assignment is allowed since C3 extends ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming 8th Questions!