Q.

Given the following code:~~~class Base { int x = 10; }~~~class Derived extends Base~~~{ int x = 20; }~~~Base b = new Base();~~~Derived d = new Derived ( );~~~Base bd = new Derived(); The statement~~~System.out.println(b.x + " " + d.x + " " + bd.x);~~~will produce the output

A. 10 20 20.
B. 20 10 20.
C. 20 20 10.
D. 10 20 10.
Answer» D. 10 20 10.
907
0
Do you find this helpful?
10

View all MCQs in

Java Programming

Discussion

No comments yet

Related MCQs