Chapter 11: Problem 14
When are you required to have a throws clause in a method header?
Short Answer
Expert verified
Answer: A throws clause is necessary in a method header in the following scenarios:
1. When your method is using a method that declares a checked exception and your method is not handling the exception using a try-catch block. In this case, you must declare the exception in the throws clause.
2. When your method explicitly throws a checked exception, you should include the throws clause in the method header.