Q41
What will be the output? class One final int a = 15; class Two extends One final int a = 20; public class Test extends Two final int a = 30; public static void main(String args[]) Test t = new One(); System.out.print(t.a);
A.
15
B.
20
C.
30
D.
Compiler Error
AnswerE.
None of these
Answer: Option D
Solution
Answer: Option D
Solution:
We can't store super class object in subclass reference But we can store subclass object in super class reference.