posted 14 years ago
IllegalThreadStateException is only thrown because of programming errors - the programmer forgot to put the call in a synchronized block / method for the object that wait, notify etc is called on. InterruptedException is, like IOException and SQLException, caused by a situation the programmer can do little about. They cannot be prevented by adding checks etc.
The general convention is:
- unchecked exceptions can be prevented by adding checks. NullPointerException, IllegalArgumentException, NoSuchElementException, in 99.99% of the cases these can be prevented (e.g. by checking against null etc).
- checked exceptions are caused by an external influence. This could be the hard disk, network, but also user interaction in the case of interrupting.
There are of course cases where exceptions don't follow this convention (CloneNotSupportedException is one of these...) but you'll see that most exceptions follow this convention.