Last Updated: June 6, 2026
A single try block often runs code that can fail in more than one way. Parsing a price string can throw NumberFormatException. Reading a cart slot can throw ArrayIndexOutOfBoundsException. Accessing a method on a null product can throw NullPointerException. Each of these failures usually deserves its own response, not a single generic "something went wrong" message. This lesson covers how to attach multiple catch blocks to one try, the rules for ordering them, the multi-catch syntax that combines several types into a single handler, and the control-flow guarantees that hold once a match is found.