Optional lesson — beyond the AP CS A exam. Catching exceptions with try/catch is not on the AP exam (which only declares throws); this is here for a fuller picture of Java.
Handling errors with try/catch
Some operations can fail at run time — dividing by zero, or reading past the end of an array. These throw an exception, which normally stops the program. A try/catch block lets you handle the error: put the risky code in try, and the recovery code in catch.