The throws clause in a method or constructor header lists the checked exceptions it may pass to its caller: void load(String name) throws IOException, SQLException. It is part of the method's contract, and callers must then handle or declare those exceptions. Do not confuse it with throw, which is a statement that throws one exception object right now.
Keep reading for free
Create a free StudyToCert account to read the rest of this lesson: 6 more sections, 4 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.