Chapter 16Exceptions and Assertions

THE OCP EXAM TOPICS COVERED IN THIS PRACTICE TEST INCLUDE THE FOLLOWING:

  • Exceptions and Assertions
    • Use try-catch and throw statements
    • Use catch, multi-catch, and finally clauses
    • Use Autoclose resources with a try-with-resources statement
    • Create custom exceptions and Auto-closeable resources
    • Test invariants by using assertions

 

  1. If a try, a catch, and a finally statement are used together but no exception is generated, which blocks are executed and in which order?

    1. try
    2. try, catch
    3. try, catch, finally
    4. try, finally
  2. Fill in the blanks: A try statement__________ a catch or a finally block, while a try-with-resources ...

Get OCA / OCP Java SE 8 Programmer Practice Tests now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.