Hacker News new | ask | show | jobs
by barbarbar 1747 days ago
Throws is for checked exceptions. Unchecked are not listed in the throws list.
1 comments

It's actually even worse: you can include both checked and unchecked exceptions in the `throws` clause. The compiler will only enforce handling of the checked exceptions included. Unchecked exceptions listed in the `throws` clause serve as an optional hint to others. Note that you can erroneously include any exceptions you like in the `throws` clause, even ones that are never thrown from the method. These quirks are often covered by static analysis.