๐Ÿ’ปap computer science a review

Finally block

Written by the Fiveable Content Team โ€ข Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examโ€ขWritten by the Fiveable Content Team โ€ข Last updated September 2025

Definition

A finally block is a section of code that follows a try-catch block and is always executed, regardless of whether an exception occurs or not. It is commonly used to perform cleanup tasks or release resources.

"Finally block" also found in: