🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Inheritance, ABC and MRO: all 10 questions

Quiz: Inheritance, ABC and MRO · Question 6 of 10

Inside a method of class B, what does super() refer to when the object is a D (with MRO D, B, C, A)?

Inside a method of class B, what does super() refer to when the object is a D (with MRO D, B, C, A)?

  1. A.Always A, B's direct parent
  2. B.C, the next class after B in D's MRO
  3. C.D itself
  4. D.object
Answer & explanation

Correct answer: C, the next class after B in D's MRO

super() follows the MRO of the actual object, not the class where it is written.

Can you get the rest right without peeking?

Take the timed Quiz: Inheritance, ABC and MRO quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →