Is there a way for a class in a package to access a class that is not in a package (i.e., those that are in the unnamed, default package)?
Created May 4, 2012
Andre van Dalen Yes, you can do that by importing the class:
package MyPackage; import RootClass; public class MyClass { public static void main(String[] argv) { RootClass obj = new RootClass(); System.out.println(obj.toString()); } }
Just make sure that the class with no package is a public class so classes outside of the empty package can access it.