Use the pseudocode below After invoking methodA which statem
Use the pseudocode below. After invoking methodA, which statements will be executed if:
1.no exceptions are thrown
2.an ExceptionA is thrown in statement8
3.an ExceptionB is thrown in statement8
4.an ExceptionC is thrown in statement8
5.an ExceptionD is thrown in statement8
public void methodA() {
statement1
try {
methodB();
statement2
} catch(ExceptionB ex) {
statement3
} catch(ExceptionC ex) {
statement4
} finally {
statement 5
}
statement6
}
public void methodB() {
statement7
try {
statement8 // this statement generates the exception when one is thrown
statement9
} catch(ExceptionA ex) {
statement10
} catch(ExceptionB ex) {
statement11
} finally {
statement12
}
statement13
}
Solution
1) statement 1,7,8,9,12,13,2,5,6
2)1,7,8,10,12,5
3)1,7,8,11,12,5
4)1,7,8,12,4,5
5) 1,7,8,12,3,5

