Skip to content

Glossary: Java Beyond the Basics

Try-with-resources

Also written: try-with-resources

try (resource) { ... } closes the resource when the block ends, even after an exception. It works with any AutoCloseable, such as files and executors.

Where the book teaches it

Related terms

AutoCloseableFiles