Skip to content

Glossary: Java Basics

catch

Also written: catch block, try/catch, try

A `try` block holds risky code, and a `catch` block says what to do if a given exception is thrown inside it. This lets a bad input like `ten` print a friendly message instead of crashing the program.

Where the book teaches it

Related terms

ExceptionThrowfinally