File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes VirtualMachine Errors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "VirtualMachine Errors" Watch "VirtualMachine Errors" New topic
Author

VirtualMachine Errors

Ikram Soomro
Ranch Hand

Joined: Oct 20, 2001
Posts: 42
Please refer to objective 2.6

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?
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
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

IllegalArgumentException
no

IllegalStateException
no

NullPointerException
yes - . operator

NumberFormatException
no

AssertionError
yes - assert statement

ExceptionInInitializerError
yes - jvm's class loader used on class named in java command

StackOverflowError
yes

NoClassDefFoundError
yes - jvm's class loader used on class named in java command

Note: This is based on my own research. Corrections are welcome.


Mike Gershman
SCJP 1.4, SCWCD in process
Ikram Soomro
Ranch Hand

Joined: Oct 20, 2001
Posts: 42
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.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: VirtualMachine Errors