Think of a hierarchy as a file system. In Java, packages are like directories, and classes are like files. Packages are designed to host a set of related classes. When there are groups of packages that are logically related to each other, they can be called so that they appear as members of a larger hierarchy. Looking at the java.awt example above. *, I could put classes for AWT in jar1. It will have the following structure:
jar-1 \-java \-awt
In the awt directory, you will find classes and interfaces that declare themselves members of the java.awt package.
Now I want to implement some fonts for awt, but I put them in a separate jar:
jar-2 \-java \-awt \-fonts
The font catalog are the classes and interfaces for fonts that I created for awt.
When you switch to a program using AWT and my fonts, you must first include both jar-1 and jar-2 in your CLASSPATH. When you include classes, you will not get any information about what jar the compiler found in them.
//this loads all classes in the java.awt directory // which happen to come from jar-1 include java.awt.*
If you want to use fonts,
//Load all classes in the java.awt.fonts directory // which happen to come from jar-2 include java.awt.fonts.*
For the compiler and runtime, the hierarchy looks like one big tree. This does not mean that all classes are physically in the same place. Having said that I have to make two points; 1) Separating packages in the same hierarchy into different banks is not recommended, as this will confuse and support a headache, and 2) declaring packages as extensions of some other package structure is an extremely bad form, even if the compiler allows it .
source share