1z0-829 Exam QuestionsBrowse all questions from this exam

1z0-829 Exam - Question 11


Given the code fragment:

Which set of class definitions compiles?

Show Answer
Correct Answer: DE

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

8 comments
Sign in to comment
meltedoliveOption: D
Jan 16, 2024

Right option is D.

supersquaxOption: D
Jan 25, 2024

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

SampsOption: D
Feb 16, 2024

Right answer is D

TojoseOption: D
Jan 11, 2024

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
May 5, 2024

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

TrinhLKOption: D
May 10, 2024

D is correct

UtemanOption: D
Jul 2, 2024

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

filledaprilOption: E
Jul 11, 2024

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