top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Java: Does importing a package imports the subpackages as well?

–2 votes
140 views

e.g. Does importing com.MyTest.* also import com.MyTest.UnitTests.*?

posted Mar 26, 2014 by Prachi Agarwal

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button
Not in Java., and not in python....Don't know about other languages :). In C and C++ there is some other mechanism

1 Answer

0 votes

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.

Credit: http://www.indiabix.com/technical/java-basics/5

answer Mar 26, 2014 by Luv Kumar
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...