Skip to content
Sharp

Object-oriented programming · interview question

Why does using super() in a constructor change runtime behavior?

Multiple choiceMediumchapter-2-curatedpremiumoopconstructors
Choose one answer
Answer and explanation

Correct answer

C. It calls the parent class's no-argument constructor

Why

The 'super()' call in a constructor invokes the parent class's no-argument constructor, ensuring proper initialization of the parent class part of the object.

Test yourself on Object-oriented programming

A free test with instant, explained results. No account needed.

Start free test
All Object-oriented programming questions →