Skip to content
Sharp

Core Java · interview question

Which design principle helps decide whether to use an interface or an abstract class?

Multiple choiceMediumchapter-5-curatedpremiumcore-javacode-reading-with-related-types
Choose one answer
Answer and explanation

Correct answer

A. Program to an interface, not an implementation.

Why

Programming to an interface, not an implementation, allows for greater flexibility and reusability of code, as it focuses on defining contracts rather than specific implementations.

Test yourself on Core Java

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

Start free test
All Core Java questions →