3 ms·
The most important problem with checked exceptions in Java is the way they interact with inheritance. If you could just declare "throws" everywhere, you could a
by JulianMorrison 17y ago
The most important problem with checked exceptions in Java is the way they interact with inheritance. If you could just declare "throws" everywhere, you could at least live up to the ideal of knowing the exceptions to expect. But you can't override and add a new "throws". Substitution principle, yeah, I know. But why did they design Runnable without "throws Exception"?
- vilya 17y agoRunnables don't throw checked exceptions for the same reason that main() doesn't - because there's nothing sensible that could catch it.
- JulianMorrison 17y agoYou can declare main() as "throws Exception".