Please look at the code below..
interface I {String s1 = "I";}
class A implements I {String s1 = "A";}
class B extends A {String s1 = "B";}
class C extends B {
String s1 = "C";
void printIt() {
System.out.print(((A)this).s1 + ((B)this).s1 +
((C)this).s1 + ((I)this).s1);
}
public static void main (String[] args) {new C().printIt();}
}
What is the result of attempting to compile and run the program?
The answer to the question is given as "ABCI"
But my doubt is that a variable declared in an interface is implicitly public static final. So it should give a compile time error.
Please clarify me if I am wrong.
Thanks,
Sharanya