Exam 1z0-829 All QuestionsBrowse all questions from this exam
Question 11

Given the code fragment:

Which set of class definitions compiles?

    Correct Answer: D

    The correct answer is D. In Java, a sealed interface explicitly lists the permitted subclasses or implementing classes. The permitted subclasses or implementing classes must be declared as either sealed, non-sealed, or final. In the provided code fragment, since SInt is a sealed interface, any class or interface that extends or implements SInt must declare whether it is sealed, non-sealed, or final. Option D correctly shows that both interfaces Story and Art extend SInt and are marked as non-sealed, which is necessary to compile without errors.

Discussion
meltedoliveOption: D

Right option is D.

SampsOption: D

Right answer is D

supersquaxOption: D

Right answer is D. E is missing "sealed", "non-sealed" or "final" modifier.

TojoseOption: D

The right option is D. non-sealed interface Story extends SInt {} non-sealed interface Art extends SInt {}, because the class in option E require an modifier

minhdevOption: D

D is correct, Sealed interface allows sealed, non-sealed interface extends it.

filledaprilOption: E

if option E is like: E. non-sealed interface Story extends SInt {} non-sealed class Art implements SInt {} , in this case should select the E

UtemanOption: D

D is the correct answer non-sealed opens up for any class to implement

TrinhLKOption: D

D is correct