JVM exceptions Those exceptions or errors that are either exclusively or most logically thrown by the JVM. NullPointerException, StackOverflowError, ArrayIndexOutOfBoundsException, ClassCastException, ExceptionInInitializerError, NoClassDefFoundError.
Programmatic exceptions Those exceptions that are thrown explicitly by application and/or API programmers. NumberFormatException, AssertionError, IllegalArgumentException, IllegalStateException.
But then when it says "it�s okay for the overriding method to throw any runtime exceptions." i got the question:
What are runtime exceptions as far as JVM and programmtic exceptions mentioned above is concerned?
Are programmatic exceptions all runtime exceptions? what about JVM exceptions? are they not runtime exceptions?
Originally posted by Jacky Zhang: How many of these are checked exceptions? How is checked exception defined?
A runtime exception is an exception that IS-A RuntimeException -- meaning an object that is either that class type or subclass of that type.
The significance of the RuntimeException class is that the compiler will not require you to declare that you throw that exception, or require you to catch it. It is basically an "unchecked" exception.
A "checked" exception is an exception that is not an "unchecked" exception -- or an exception that is not a RuntimeException.
[EDIT: new text below]
Just realize that this thread also refers to errors.
An Error is a throwable object that IS-A Error -- meaning an object that is either that class type or subclass of that type.
Like runtime exceptions, it is also unchecked. However, it is separated from runtime exceptions because it is *not* recommended that you catch these, as they generally indicate an abnormal condition that may not be recoverable.
Henry [ September 20, 2006: Message edited by: Henry Wong ]
Hi Jacky, "Are programmatic exceptions all runtime exceptions?" It depends : There is an actual class called RuntimeException. If a particular exception entends this, then it is a runtime exception. Examples include ArrayIndexOutOfBoundsException & NullPointerException. There are not checked exceptions in that they dont need to be declared as a possible exception that could be thrown from a method. Similarly the dont need to be handled by the calling method with an explicit catch or declare.
"what about JVM exceptions? are they not runtime exceptions?" Some of them are - ArrayIndexOutOfBoundsException, NullPointerException as mentioned. However, StackOverflowError is an error, not an exception. Errors are far more serious and shouldnt really be handled by application.