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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.