Java SE 13: Correctly Using Try-Catch-Finally Blocks

Expected Duration
Lesson Objectives
Course Number
Expertise Level


This course covers the bedrock of Exception Handling in Java, the try-catch-finally code structure. Participants will cover the class hierarchies in exception handling; the stream and file processing; and how Java's support for exceptions and streams is built around complex class structures. You will learn how code might result in exceptions that are enclosed within a try block. Because this code structure could result in a signal to Java that normal programming might be disrupted and will cause the code evaluation to be short-circuited, the course explores details of catch blocks, including the use of multiple catch blocks; the use of the pipe operator (operator) to chain different exceptions within the same catch block; and how catch blocks must be arranged for related exceptions. The last part of exception handling is the 'finally block.' This keyword (finally) is used to ensure the correct release of resources, such as file handles, no matter what handled or unhandled exceptions might arise within the try block.


Expected Duration (hours)

Lesson Objectives

Java SE 13: Correctly Using Try-Catch-Finally Blocks

  • discover the key concepts covered in this course
  • identify the situations when divide-by-zero exceptions arise
  • apply the methods of the Exception base class to obtain exception information
  • use multiple independent catch blocks with a single try block
  • combine multiple independent catch blocks using the | operator
  • combine multiple related catch blocks using the | operator
  • employ correct exception-handling techniques for IO-intensive operations such as working with files
  • use the finally keyword to ensure correct release of file handles and other system resources
  • recognize the exact semantics and limitations of the finally block
  • correctly place the finally block relative to the catch blocks
  • summarize the key concepts covered in this course
  • Course Number:

    Expertise Level