6. What is the output of the following code? class A { public int i; void display () { System.out.println (i); } class B extends A { public int j; void display () { System.out.println (j); } class...


6. What is the output of the following code?<br>class A {<br>public int i;<br>void display () {<br>System.out.println (i);<br>}<br>class B extends A {<br>public int j;<br>void display () {<br>System.out.println (j);<br>}<br>class TestDriver {<br>public static void main (String args[]) {<br>B obj<br>obj.i = 1;<br>obj.j = 2;<br>obj.display ();<br>new B();<br>А. 0<br>В. 1<br>С. 2<br>D. Compile error<br>E. None of the above<br>

Extracted text: 6. What is the output of the following code? class A { public int i; void display () { System.out.println (i); } class B extends A { public int j; void display () { System.out.println (j); } class TestDriver { public static void main (String args[]) { B obj obj.i = 1; obj.j = 2; obj.display (); new B(); А. 0 В. 1 С. 2 D. Compile error E. None of the above

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here