Java OCA OCP Practice Question 1013

Question

When developing a desktop application,

Which of the following exceptions would be appropriate to throw explicitly from the code?

Select 1 option

  • A. NullPointerException
  • B. ClassCastException
  • C. ArrayIndexOutofBoundsException
  • D. Exception
  • E. NoClassDefFoundError


Correct Option is  : D

Note

NoClassDefFoundError is thrown by the JVM when it attempts to load a class and is unable to find the class file.

It extends java.lang.Error and Errors are always thrown by the JVM.

A programmer should never throw an Error explicitly.




PreviousNext

Related