Skip to content
Sharp

Language Upgrades · interview question

Given a sealed interface, which of the following is NOT a correct way to implement it?

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

Correct answer

B. Using a non-sealed class that is not listed in the permits clause.

Why

A non-sealed class not listed in the permits clause cannot implement a sealed interface, as it violates the restrictions set by the permits clause, leading to a compilation error.

Test yourself on Language Upgrades

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

Start free test
All Language Upgrades questions →