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.
πŸ’¬ Discuss
βœ… Correct Answer: (D) 10 20 10.

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
153
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
84%
Success Rate