Vidyalelo
Java Programming · Q86

Inheritence

Programming · Java Programming · question 86

Q86

What will be the output of the following Java code? class A public int i; public int j; A() i = 1; j = 2; class B extends A int a; B() super(); class super_use public static void main(String args[]) B obj = new B(); System.out.println(obj.i + " " + obj.j)

A.
1 2
Answer
B.
2 1
C.
Runtime Error
D.
Compilation Error

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board