nerdexam
Oracle

1Z0-804 · Question #156

Which two statements are true regarding the try with resources statement?

The correct answer is B. In a try with resources statement, any catch or finally block is run after the resources have been closed. D. All the resources must implement the java.io.closeable interface. See the full explanation below for the reasoning.

Question

Which two statements are true regarding the try with resources statement?

Options

  • AThe resources declared in a try with resources statement are not closed automatically if an exception
  • BIn a try with resources statement, any catch or finally block is run after the resources have been closed.
  • CThe close methods of resources are called in the reverse order of their creation.
  • DAll the resources must implement the java.io.closeable interface.

How the community answered

(36 responses)
  • A
    8% (3)
  • B
    75% (27)
  • C
    17% (6)

Community Discussion

No community discussion yet for this question.

Full 1Z0-804 Practice