Question: 1 interface I { 2 String s1 = I; 3 } 4 class A implements I { 5 String s1 = A; 6 } 7

1 interface I {

2 String s1 = "I";

3 }

4 class A implements I {

5 String s1 = "A";

6 }

7 class B extends A {

8 String s1 = "B";

9 }

10 class C extends B {

11 String s1 = "C"; 12

13 void printIt() {

14 System.out.print(((A)this).s1

+ ((B)this).s1

+ ((C)this).s1

+ ((I)this).s1);

15 }

16

17 public static void main (String[] args) { 18 new C().printIt();

19 }

20 }

}}

What is the result of attempting to compile and run the program?

Prints: ABCI

Run-time error

Compile-time error

None of the above

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!