What Will Be The Output Of The Following Java Code P Pre #882
What will be the output of the following Java code? </p> <pre><code class="language-java"> class X { int a; } class Y extends X { public void B() { a=10; System.out.println(a); } } class Z extends X { public void C() { a=5; System.out.println(a); } } class V extends Y { public void D() { a=15; System.out.println(a); } } public class Value { public static void main(String[] args) { V obj=new V(); obj.B(); obj.D(); } } </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) - Hybrid Inheritance - Quiz No.2.