2.6 Recognize situations that will result in any of the following being thrown: ArrayIndexOutOfBoundsException,ClassCastException, IllegalArgumentException, IllegalStateException, NullPointerException, NumberFormatException, AssertionError, ExceptionInInitializerError, StackOverflowError or NoClassDefFoundError. Understand which of these are thrown by the virtual machine and recognize situations in which others should be thrown programatically.
can we say that the Error exceptopns those extends java.lang.VirtualMachineError class (like StackOverflowError does) are thrown by JVM?
This is an interesting question. They didn't ask which exceptions are errors in the java virtual machine but which exceptions are thrown by the java virtual machine.
The jvm has its own class loader for the class named in the java command and for many system classes, so some errors involving the class containing your main() method will be thrown by the jvm.
ArrayIndexOutOfBoundsException yes -  operator
ClassCastException yes - () operator
NullPointerException yes - . operator
AssertionError yes - assert statement
ExceptionInInitializerError yes - jvm's class loader used on class named in java command
NoClassDefFoundError yes - jvm's class loader used on class named in java command
Note: This is based on my own research. Corrections are welcome.
SCJP 1.4, SCWCD in process
Joined: Oct 20, 2001
Thanks Mike Gershman for your explanation on exceptions listed in objective 2.6 but I think there is more discussion required on this objective. If any body has study on this objective or know any link about it than please share it with all of us.