This 1Z0-829 practice question tests your understanding of utilizing java object-oriented approach. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. A key principle to apply: sealed Interface. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
Exhibit
sealed class Shape permits Circle, Rectangle {
void draw() { System.out.println("Shape"); }
}
non-sealed class Circle extends Shape {
void draw() { System.out.println("Circle"); }
}
final class Rectangle extends Shape {
void draw() { System.out.println("Rectangle"); }
}
class Triangle extends Shape { // Line 10
void draw() { System.out.println("Triangle"); }
}
Refer to the exhibit. What is the result?
Exhibit
sealed class Shape permits Circle, Rectangle {
void draw() { System.out.println("Shape"); }
}
non-sealed class Circle extends Shape {
void draw() { System.out.println("Circle"); }
}
final class Rectangle extends Shape {
void draw() { System.out.println("Rectangle"); }
}
class Triangle extends Shape { // Line 10
void draw() { System.out.println("Triangle"); }
}
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Compilation fails at line 10
In Java 17, when a sealed interface (like `Shape`) declares a `permits` clause listing permitted subclasses (e.g., `Circle`), each permitted subclass must explicitly declare itself as `sealed`, `non-sealed`, or `final`. If the `Circle` class is defined as `class Circle implements Shape` without any of these modifiers, compilation fails at line 10 where that class is defined. The error is that the class is not allowed to extend/implement the sealed interface unless it has the required modifier.
Key principle: Sealed Interface
Common exam traps
Common exam trap: answer the scenario, not the keyword
Candidates often overlook the mandatory modifier (`sealed`, `non-sealed`, or `final`) on each permitted subclass of a sealed type. Even if the class is logically final (e.g., all methods are final or the class is implicitly final), the Java compiler requires an explicit keyword.
Detailed technical explanation
How to think about this question
Under Java 17's sealed classes (JEP 409), a permitted subclass must be declared with exactly one of `final`, `sealed`, or `non-sealed`. This ensures the compiler can enforce the sealed hierarchy at compile time. If a permitted subclass omits this modifier, the compiler rejects the code with an error like 'permits clause does not allow class to be non-sealed' or 'class is not allowed to extend sealed class'. This design prevents accidental breaking of the sealed contract.
KKey Concepts to Remember
Sealed Interface
Permitted Subclass Modifier Requirement
Compilation Error for Missing Modifier
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Sealed Interface
Real-world example
How this comes up in practice
A security administrator must allow nursing staff to reach a patient records server while blocking access from the guest Wi-Fi VLAN. After applying an extended ACL, traffic is still blocked from nursing workstations. The ACL was applied outbound instead of inbound on the wrong interface. Questions like this test ACL direction and placement rules.
What to study next
Got this wrong? Here's your next step.
Review sealed Interface, then practise related 1Z0-829 questions on the same topic to reinforce the concept.
The correct answer is: Compilation fails at line 10 — In Java 17, when a sealed interface (like `Shape`) declares a `permits` clause listing permitted subclasses (e.g., `Circle`), each permitted subclass must explicitly declare itself as `sealed`, `non-sealed`, or `final`. If the `Circle` class is defined as `class Circle implements Shape` without any of these modifiers, compilation fails at line 10 where that class is defined. The error is that the class is not allowed to extend/implement the sealed interface unless it has the required modifier.
What should I do if I get this 1Z0-829 question wrong?
Review sealed Interface, then practise related 1Z0-829 questions on the same topic to reinforce the concept.
What is the key concept behind this question?
Sealed Interface
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
This 1Z0-829 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-829 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.