In the Java language use the provided code to answer the following: Which statem
ID: 3685965 • Letter: I
Question
In the Java language use the provided code to answer the following:
Which statements execute if no exceptions are thrown?
Which statements will execute if an exception of type ExceptionS is thrown before statement11 in methodB?
Which statements will execute if an exception of type ExceptionR is thrown before statement11 in methodB?
Which statements will execute if an exception of type ExceptionQ is thrown before statement11 in methodB?
Which statements will execute if an exception of type ExceptionC is thrown before statement11 in methodB?
public static void main(String[] args) {
try {
statement1;
methodA();
statement2;
} catch (ExceptionQ ex) {
statement3;
} finally {
statement4;
}
statement5;
}
public static void methodA() {
try {
statemen6;
methodB();
statement7;
} catch (ExceptionR ex) {
statement8;
} finally {
statement9;
}
statement10;
}
public static void methodB() {
try {
statement11;
} catch (ExceptionS ex) {
statement12;
} catch (ExceptionT ex) {
statement13;
} finally {
statement14;
}
statement15;
}
Explanation / Answer
Which statements execute if no exceptions are thrown?
Answer:statements 1,6,11,14,15,7,9,2,4 will be executed if there are no exceptions thrown
Which statements will execute if an exception of type ExceptionS is thrown before statement11 in methodB?
Answer: statements 1,6,12,14,7,9,2 and 4 will be executed if an exception s is thrown befdore state by h
Which statements will execute if an exception of type ExceptionR is thrown before statement11 in methodB?
Answer: statements 1,6,14,7,9,2,4 will be executed if an exception of type Exeception R is thrown before statement 11 in Method B.
Which statements will execute if an exception of type ExceptionQ is thrown before statement11 in methodB?
Answer: statements 1,6,14,7,9,2 and 4 will be executed .
Which statements will execute if an exception of type ExceptionC is thrown before statement11 in methodB?
Answer: statements 1,6,14,7,9,2 and 4 will be executed.
for further queries kindly get back