← Quiz: Records and Sealed Classes: all 10 questions
Quiz: Records and Sealed Classes · Question 7 of 10
A class listed in permits is declared as plain class Square implements Shape. What happens?
A class listed in permits is declared as plain class Square implements Shape. What happens?
- A.It compiles; final is the default
- B.It compiles but throws at runtime
- C.Compile error: it must be declared final, sealed or non-sealed
- D.The sealed interface becomes open
Answer & explanation
Correct answer: Compile error: it must be declared final, sealed or non-sealed
Every permitted subclass must state how the hierarchy continues (records are already final, so they are fine).
Can you get the rest right without peeking?
Take the timed Quiz: Records and Sealed Classes quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →