Oracle
1Z0-811 · Question #20
1Z0-811 Question #20: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-811 to reveal the answer and full explanation for question #20. The question stem and answer options stay visible for context.
Exception Handling and Methods
Question
Given the code fragment:
public static void main (String[] args) {
int[] arr = {10, 0};
int i = 0;
try {
int answer = arr[i] / arr[i + 1];
} catch (Exception e) {
System.out.println ("Unknown issues.");
} catch (ArithmeticException ae) {
System.out.println ("Invalid divisor.");
}
}
What is the result?
Options
- AUnknown issues. Invalid divisor.
- BUnknown issues.
- CInvalid divisor.
- DA compilation error occurs.
Unlock 1Z0-811 to see the answer
You've previewed enough free 1Z0-811 questions. Unlock 1Z0-811 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#exception handling#catch block ordering#exception hierarchy#compilation error