Skip to content
Sharp

Language Upgrades · interview question

Which Java keyword would you use to specify the classes that can extend a sealed class?

Multiple choiceMediumchapter-12-curatedpremiumlanguage-upgradessealed-classes
Choose one answer
Answer and explanation

Correct answer

A. Permits

Why

The 'permits' keyword is used in the declaration of a sealed class to specify which classes are allowed to extend it. This helps to enforce controlled inheritance.

Test yourself on Language Upgrades

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

Start free test
All Language Upgrades questions →