Class organization with packages
All JVM languages define their own syntaxes for creating classes and instantiating objects, but in the end, they produce class files that would run on the JVM. In order to be able to run on the JVM and be able to offer interoperability with classes written in other languages on the JVM platform, they have to follow JVM's requirements for organizing classes. We'll discuss the following topics:
- Packages
- Choosing a package
- Package examples
- Fully qualified class names
Note
Knowledge of packages is required to understand the organization of the Java Class Library and how to run JVM applications on the command line. Both these topics are discussed in this chapter.
What are packages?
Most languages covered in this book support grouping classes in packages. Classes that are grouped inside a package form a unique namespace. This is the fundamental feature of a JVM. Some languages cannot group classes in a package themselves, but they still support referencing classes inside...