Java OCA OCP Practice Question 209

Question

Given a class that uses the following import statements,

which class would not be automatically accessible within the class without using its full package name?

import mypkg.*; 
import mypkg.mypkg.*; 
  • A. mypkg.mypkg.mypkg.MyClass
  • B. mypkg.mypkg.Georgette
  • C. mypkg.Webby
  • D. java.lang.Object


A.

Note

Options B and C are accessible within the class as they are covered by the import statements.

Option D is fine as java.lang.Object is available without an explicit import.

The only class not automatically accessible within the class without the full package name is mypkg.mypkg.mypkg.MyClass as the import statements do not include sub-packages; therefore, Option A is the correct answer.




PreviousNext

Related