What Will Be The Output Of The Following Java Codep Pre #860
What will be the output of the following Java code?</p> <pre><code class="language-java"> class A { static int a =5; } class B extends A { B() { A.a = 10; } } class C extends A { C() { A.a = 15; } } class D extends A { D() { A.a = 20; } } public class DotOperator { public static void main(String[] args) { B obj1 = new B(); C obj2 = new C(); D obj3 = new D(); System.out.println(A.a); } } </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs111 OOP Object Oriented Programming Java. It can also be found in gs gs111 Inheritance (Using Java) - Hierarchical Inheritance - Quiz No.1.