1Z0-829 Handling Exceptions Practice Question
Which of the following is a best practice when creating a custom exception class?
⚠ Common exam trap
A common mix-up: candidates think extending Throwable directly is acceptable for creating a new exception type, but the Java Language Specification recommends extending Exception or RuntimeException to maintain consistency with the standard hierarchy and avoid confusing checked/unchecked semantics.
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
✓
Extend RuntimeException for an unchecked exception.
Extending RuntimeException is the standard way to create a custom unchecked exception in Java. Unchecked exceptions do not require explicit handling via try-catch or throws clauses, making them suitable for programming errors like invalid arguments or illegal states. This aligns with Java's exception hierarchy where RuntimeException and its subclasses are unchecked.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Implement the Exception interface.
Why it's wrong here
Exception is a class, not an interface.
- ✗
Extend Error to indicate a serious system error.
Why it's wrong here
Error is for JVM errors, not application exceptions.
- ✓
Extend RuntimeException for an unchecked exception.
Why this is correct
Standard practice for custom exceptions that represent programming errors.
- ✗
Extend Throwable directly to create a new exception type.
Why it's wrong here
Should extend Exception or RuntimeException.
Go deeper
Related to this question
About these practice questions
One of 513 original 1Z0-829 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
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.