MCQs > IT & Programming > Java > Output of the given program? public class Test128 { public static void main(String[] args) { A a = new A2(); B b = new B2(); System.out.println(a.a + b.b); } } class A { int a = 1; } class A2 extends A { int a = 2; } class B { public int b = 1; } class B2 extends B { public int b = 2; }

Java MCQs

What is the output of the given program? public class Test128 { public static void
main(String[] args) { A a = new A2(); B b = new B2(); System.out.println(a.a + b.b); } }
class A { int a = 1; } class A2 extends A { int a = 2; } class B { public int b = 1; } class B2
extends B { public int b = 2; }

Answer

Correct Answer: 2

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Java Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

More Java MCQ Questions

search

Java Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it