Consider the following diagram:
public static void readDatabase() {
try {
DBClass.batchUpdate();
//throws BatchUpdateException
} catch(SQLException) {
System.out.println("SQLException");
}
System.out.println("Continue");
}
a. |
“SQLException” |
c. |
“Continue” |
b. |
“BatchUpdateException” |
d. |
“SQLException” and “Continue” |
d) “SQLException” and “Continue” Explanation: ------------- DBClass.batchUpdate(); //throws BatchUpdateException BatchUpdateException is a subclass of SQLException so, catch(SQLException) block will catch this exception and it's body is executed, which prints SQLException and the code after this try-catch block will continue executing as normal, which prints Continue hence the output to this code is SQLException Continue
Get Answers For Free
Most questions answered within 1 hours.