Skip to content
Sharp

Core Java · interview question

Which Java keyword would you use to prevent a class from being subclassed in Java?

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

Correct answer

A. Final

Why

The 'final' keyword is used to prevent a class from being subclassed, as it indicates that no other class can extend this class.

Test yourself on Core Java

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

Start free test
All Core Java questions →