I've been trying to make little programs that generate the various exceptions k&b list on p378 of their
java 6 book.
Could anyone give me an example of the simplest thing a program could attempt in order to get an
IllegalStateException from one of the java SE api classes?
I've been experimenting with things such as
where the file IllegalStateExceptionDemo.txt does already exist, but I've made it read-only. However, that throws a FileNotFoundException.
I know I could make my own class that throws whatever exception I want, but I'm interested in seeing how IllegalStateException is thrown by one of the existing classes.
Richard