Skip to content
Sharp

Object-oriented programming · interview question

How can constructor chaining be achieved within the same class?

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

Correct answer

D. By calling 'this()'.

Why

Constructor chaining within the same class is achieved by calling another constructor of the same class using 'this()'. This can simplify code by reusing constructor logic.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →