Question: Mark each assigment statement in the following Java program with one of these three comments: legal - if the assignment statement is legal as written.

Mark each assigment statement in the following Java program with one of these three comments: "legal" - if the assignment statement is legal as written. "illegal unless casted" - if the assignment statement is illegal as written but would become legal if a cast were inserted. "illegal even if casted" - if the assignment statement would remain illegal even with a cast. For each, be sure to give a convincing explanation for your answer.

class C1 implements I2 { }

class C2 implement I1 { }

class C3 extends C2 implements I2 { }

interface I1 { }

interface I2 { }

class Test {

C1 c1;

C2 c2;

C3 c3;

I1 i1;

I2 i2;

{

c1 = c2;

c1 = c3;

c1 = i1;

c1 = i2;

c2 = c1;

c2 = c3;

c2 = i1;

c2 = i2;

c3 = c1;

c3 = c2;

c3 = i1;

c3 = i2;

i1 = c1;

i1 = c2;

i1 = c3;

i1 = i2;

i2 = c1;

i2 = c2;

i2 = c3;

i2 = i1;

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!