Skip to content
Sharp

Object-oriented programming · interview question

Which of the following statements about method overriding is true?

Multiple choiceMediumchapter-5-curatedpremiumoopmethod-overriding
Choose one answer
Answer and explanation

Correct answer

D. Overridden methods must have the same return type or a subtype.

Why

When overriding a method, the return type must be the same or a subtype of the method in the superclass. Static methods cannot be overridden, constructors cannot be overridden, and using the super keyword is optional.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →