DEV Community


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

siy profile image
Sergiy Yevtushenko

There is no notion of "current path" in regard to package structure in Java. Nor there are any parent-child relationship. In other words, every single package is independent and should be specified with the complete package name starting from the root. So, if you have package and class within this package need to import some class from subpackage called localfolder (as in your example), you need to specify full import path: You also can import nested classed from classes, for example

baenencalin profile image
Calin Baenen Author

Thank you! This is exactly what I'm looking for, it really helps with a "special prohect".

Here's a teasing hint: Interpreted language.

Again, thanks for the help.