0

My query is similar to How to import classes defined in other packages in same project in eclipse?, which was closed as “unclear”, without any proper solutions being suggested. Let me try to see if I can describe my setup more clearly than the original poster.

I have a project named MyProject. Under the MyProject project there are three packages, the default package, Pkg1 and Pkg2. The default package contains ClassA, Pkg1 contains ClassB and Pkg2 contains ClassC.

ClassC (in Pkg2) needs to reference ClassA (in default package) and ClassB (in Pkg1). The import statement "import Pkg1.ClassB;" works like a charm but I am unable to figure out how to import ClassA.

Regards, Sandeep

Sandeep
  • 1,245
  • 1
  • 13
  • 33
  • Because you say importing classes from non-default packages works, I think your question is more like "*How to import a class from the default package?*" and it was answered here: [How to access java-classes in the default-package?](https://stackoverflow.com/questions/283816/how-to-access-java-classes-in-the-default-package) – Zabuzard Aug 15 '17 at 18:58
  • The **real** answer: you only use the default package for super quick dirty testing. In anything that is more than that - you do not use that package. It is that simple. A project that has two other packages doesnt use the default package on top of that. Anything else is just asking for (pointless) waste of time and energy. – GhostCat Aug 15 '17 at 19:18

0 Answers0