Java OCA OCP Practice Question 607

Question

Which import statement is required to be declared in order to use the Exception, RuntimeException, and Throwable classes in an application?

  • A. import java.exception.*;
  • B. import java.util.exception.*;
  • C. import java.lang.*;
  • D. None of the above


D.

Note

All three of those classes belong to the java.lang package, so Option C seems like the correct answer.

The Java compiler includes java.lang by default,

so no import statement is actually required to use those three classes.

Option D is the correct answer.




PreviousNext

Related