CHAPTER 7

image

Exceptions and Assertions

Certification Objectives

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

In this chapter, you’ll learn about Java’s support for exception handling in detail. The OCAJP 8 exam (which is a pre-requisite for OCPJP 8 exam) covers fundamentals of exception handling as an exam topic. Hence, we assume that you are already familiar with the basic syntax used for exception handling and types of exceptions. In this chapter, you’ll learn how ...

Get Oracle Certified Professional Java SE 8 Programmer Exam 1Z0-809: A Comprehensive OCPJP 8 Certification Guide 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.