Sushant very good question
I tried to solve this.
See code:
When you run this program, you will get
Exception in thread "main" java.util.FormatterClosedException
and this FormatterClosedException is the child of IllegalStateException.
public class FormatterClosedException extends IllegalStateException
Here this exception is not thrown by JVM, it is thrown programmatically by the Formatter API developers, if you see the code of Formatter API, you will find this method get called.
private void ensureOpen() {
if (a == null)
throw new FormatterClosedException();
}
You can see the developer is throwing this exception that is the child of IllegalStateException. Any doubt ???
[ December 21, 2008: Message edited by: punit singh ]