Java OCA OCP Practice Question 603

Question

Which keywords are required with a try statement?

  • I. catch
  • II. finalize
  • III. finally
  • A. I only
  • B. II only
  • C. I or III, or both
  • D. None of these statements are required with a try statement.


C.

Note

A try statement requires a catch or a finally block.

Without one of them, the code will not compile; therefore.

Option D is incorrect.

A try statement can also be used with both a catch and finally block.

Option C is the correct answer.

finalize is not a keyword, but a method inherited from java.lang.Object.




PreviousNext

Related