• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

VirtualMachine Errors

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ikram Soomro
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic