1Z0-829 Handling Exceptions Practice Question
Which TWO are valid multi-catch statements in Java 17? (Choose two.)
⚠ Common exam trap
The trap here is that candidates often forget the rule that multi-catch types must be unrelated in the class hierarchy, leading them to incorrectly select options that include a parent and child exception (like Exception and RuntimeException) or a subclass and its superclass (like IOException and FileNotFoundException).
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
✓
catch (SQLException | IOException e)
Java 17 allows a multi-catch clause to handle multiple exception types in a single catch block, provided the exception types are unrelated in the class hierarchy. SQLException and IOException are both checked exceptions that do not inherit from each other, so they can be caught together in a multi-catch statement.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
catch (SQLException | IOException e)
Why this is correct
Valid; they are unrelated.
- ✗
catch (Exception | RuntimeException e)
Why it's wrong here
RuntimeException is a subclass of Exception, so invalid.
- ✗
catch (SQLException | Exception e)
Why it's wrong here
SQLException is a subclass of Exception, so invalid.
- ✗
catch (IOException | FileNotFoundException e)
Why it's wrong here
FileNotFoundException is a subclass of IOException, so invalid.
- ✓
catch (IOException | RuntimeException e)
Why this is correct
Valid; they are unrelated.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 1Z0-829 question from scratch — 513 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. 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.