I have a class that constructs and returns objects based on certain criteria, each method in the class throws the same exceptions and I would like to reduce the number of times I have to repeat the same:
public Foo getFoo() throws FileNotFoundException, IOException { ... }
Is there a way to declare that each method of a class throws the same set of exceptions?
No there is no way to declare that all methods of particular class throws same set of Exceptions (as of jdk 1.8u5)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With