Please help with Java homework Use the code below to answer the next 4 questions
ID: 3918199 • Letter: P
Question
Please help with Java homework
Use the code below to answer the next 4 questions.
public static void main(String[] args) {
try {
statement1;
method1();
statement2;
} catch (ExceptionA ex) {
statement3;
} finally {
statement4;
}
statement5;
}
public static void method1() {
try {
statement6;
} catch (ExceptionB ex) {
statement7;
} catch (ExceptionC ex) {
statement8;
} finally {
statement9;
}
statement10;
}
1.
Which statements will execute if no exception is thrown?
statement5
2.
Which statements will execute if an exception of type ExceptionB is thrown in the try-block of method1 before statement6?
statement9
3.
Which statements will execute if an exception of type ExceptionA is thrown in the try-block of method1 before statement6?
statement3
4.
Which statements will execute if an exception of type ExceptionM is thrown in the try-block of method1 before statement6?
statement4
statement9Explanation / Answer
1) statement1, statement6, statement9, statement10, statement2, statement4, statement5 2) statement1, statement7, statement9, statement10, statement2, statement4, statement5 3) statement1, statement9, statement3, statement4, statement5 4) statement1, statement9, statement4
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.