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
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)- A8% (3)
- B74% (28)
- C5% (2)
- D13% (5)
Community Discussion
No community discussion yet for this question.
