---
title: "Does importing a package imports the subpackages as well? e.g. Does importing com.MyTest.* also import com.MyTest.UnitTests.*?"  
description: "Does importing a package imports the subpackages as well? e.g. Does importing com.MyTest.* also import com.MyTest.UnitTests.*?"  
author: "Anonymous User"  
published: 2015-07-24  
updated: 2020-09-24  
canonical: https://www.mindstick.com/interview/2729/does-importing-a-package-imports-the-subpackages-as-well-e-g-does-importing-com-mytest-also-import-com-mytest-unittests  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# 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.

## Answers

### Answer by Anonymous User

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.


---

Original Source: https://www.mindstick.com/interview/2729/does-importing-a-package-imports-the-subpackages-as-well-e-g-does-importing-com-mytest-also-import-com-mytest-unittests

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
