Lesson 8. Exceptions and Logging

In this lesson you will learn about exceptions and logging. Exceptions in Java are a transfer control mechanism. You generate exceptions to signal problematic conditions in your code. You write code to either acknowledge or handle exceptions that are generated.

Java provides a flexible logging facility that allows you to record information as your application executes. You might choose to log exceptions, interesting occurrences, or events that you want to track.

Things you will learn include:

• the try-catch block

• checked vs. unchecked (runtime) exceptions

• errors vs. exceptions

• the throws clause

• the exception hierarchy

• creating your own exception type

• exception messages

• working with multiple exceptions ...

Get Agile Java™: Crafting Code with Test-Driven Development now with O’Reilly online learning.

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