DOES IMPORTING A PACKAGE IMPORTS THE SUBPACKAGES AS WELL? E.G. DOES IMPORTING COM.MYTEST.* ALSO IMPORT COM.MYTEST.UNITTESTS.*?

Mayank Tripathi

Total Post:807

Points:4035
Posted by  Mayank Tripathi
Java 
 603  View(s)
Ratings:
Rate this:
  1. Mayank Tripathi

    Post:807

    Points:4035
    Does importing a package imports the subpackages as well? e.g. Does importing com.MyTest.* also import com.MyTest.UnitTests.*?

    No you will have to import the subpackages explicitly. Importing com.MyTest.* will import classes in the package MyTest only. It will not import any class in any of it's subpackage.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!