DEV Community

Discussion on: Can I import local class files in Java, like you can Python?

Collapse
 
thefern profile image
Fernando B 🚀

There isn't such thing as nested packages like you've shown. Packages are all independent of each other. Here's an explanation of hierarchy stackoverflow.com/questions/265092...

Thread Thread
 
baenencalin profile image
Calin Baenen

But, can a package be in a directory below the current package?
If not, where would the packages have to be, and how would I enforce this on to the computer of the user that uses my program?

Thread Thread
 
thefern profile image
Fernando B 🚀

Sorry is been a while since I last program in Java memory is a bit blurry. According to SO you can't have nested packages, but I just tried and I was able to create a package inside a package. So what you're trying to do is doable.

studytonight.com/java/subpackage-a...