Skip to content
Sharp

Object-oriented programming · interview question

Why is it useful to declaring a class as abstract in Java?

Multiple choiceEasychapter-5-curatedpremiumoopabstract-classes
Choose one answer
Answer and explanation

Correct answer

B. To prevent the class from being instantiated directly

Why

An abstract class cannot be instantiated directly. It is meant to be subclassed, allowing child classes to provide implementations for abstract methods.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →