I'm not exactly sure what you are asking here, but it is possible, in fact, necessary, to reference a class in one package from another package. You use java.lang classes in your own class which, if not specifically declared to be in a package, belongs to an anonymous package distinct from java.lang. [ July 12, 2006: Message edited by: Joe Ess ]
All the classes in Java are located in a package. If the class is not declared in particular package it is said that the class is in the default package.
The declaration of the package of class appears at the beginning of the source file. Somewhat like this: package java.io.InputStream or java.lang.String.
For instance, this code is valid:
Now, a class should be referenced using it fully qualified named, but if you want to avoid the use of such long names as java.java.util.concurrent.locks.Lock, then you can import the class so that you can use its canonical name.