Suppose that statement2 causes an exception in the following try-catch block: (1
ID: 3796085 • Letter: S
Question
Suppose that statement2 causes an exception in the following try-catch block: (10 points) public void m2() { m1(); } public void m1() { try { statement1; statement2; statement3; } catch (Exception1 ex1) { } catch (Exception2 ex2) { } catch (Exception3 ex3) { throw ex3; } finally { statement4; } Statement5; } Answer the following questions: Will statement1 be executed? Will statement3 be executed? If the exception is not caught, will statement4 be executed? If the exception is not caught, will statement5 be executed? If the exception is caught in the catch block, will statement4 be executed? If the exception is caught in the catch block, will statement5 be executed? If the exception is of type Exception2, will statement4 be executed? If the exception is of type Exception2, will statement5 be executed? If the exception is of type Exception3, will statement4 be executed? If the exception is of type Exception3, will statement5 be executed? Question 4 options:
Explanation / Answer
If statement2 causes an exception Statement 1 will be executed, Statement 3 will not be executed.
If exception is not caught Statement 4 will still be executed in any case
If exception is not caught Statement 5 will still be executed.
Statement 4 will be executed in all cases
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.