Suppose that the table food has five rows and this SQL statement updates all of them.
What is the result of this code?
public static void main(String[] args) { Connection conn = DriverManager.getConnection("jdbc:derby:zoo"); Statement stmt = conn.createStatement(); int result = stmt.executeUpdate("update food set amount = amount + 1"); System.out.println(result); }
D.
JDBC code throws a SQLException, which is a checked exception.
The code does not handle or declare this exception, and therefore it doesn't compile.
If the exception were handled or declared, the answer would be choice C.