nerdexam
Oracle

1Z0-804 · Question #71

Given the code fragment: What change should you make to apply good coding practices to this fragment?

The correct answer is B. Add the statement and ResultSet declarations to the try-with-resources statement. See the full explanation below for the reasoning.

Question

Given the code fragment:

What change should you make to apply good coding practices to this fragment?

Exhibit

1Z0-804 question #71 exhibit

Options

  • AAdd nested try-with-resources statements for the statement and ResultSet declarations.
  • BAdd the statement and ResultSet declarations to the try-with-resources statement.
  • CAdd a finally clause after the catch clause.
  • DRethrow SQLException.

How the community answered

(38 responses)
  • A
    8% (3)
  • B
    74% (28)
  • C
    5% (2)
  • D
    13% (5)

Community Discussion

No community discussion yet for this question.

Full 1Z0-804 Practice