Single Choice Not Set

QWhat 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);
      }
}

ID: #2261 Inheritance in Java MCQ 2,364 views
Question Info
#2261Q ID
Not SetDifficulty
Inheritance in Java MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A 15
  • B 20
  • C 30
  • D Compiler Error
Correct Answer

Explanation

Compiler Error

Share This Question

Challenge a friend or share with your study group.