As the title suggests, how can I tell a JVM thrown exception from a Programmatically(does this mean, thrown by a programmer or the program) thrown exception ?
JVM Exceptions
1) ArrayIndexOutOfBoundsException
2) ClassCastException
3) NullPointerException
Programmatically thrown
1) NumberFormatException
2) AssertionError
Many Thanks
I’m not sure what you mean by JVM exceptions. These are all runtime exceptions that may be thrown by the programmer at any point (exception
AssertionError), though it is considered poor style to throw certain exceptions likeNullPointerException. The point is, there’s no one quality separating the two categories you mention other than their typical usage. All the runtime exceptions extend, either directly or indirectly,RuntimeException.From the JavaDocs for
Throwable:Because this same superclass defines all exceptions thrown by either the JVM or a programmer, you can’t easily distinguish the two.