When you start to develop more complicated Java applications, you may end up with a large number of source code, bytecode, and support files. Java provides packages and Java Archive (JAR) files to help you organize and store your work. Packages are used to separate and organize a collection of classes and interfaces. One reason to place your files in a package is to avoid naming conflicts. Two classes can't share the same name unless they are placed in different packages. If you write a class with an obvious name such as
Beam, you don't have to worry about whether that name is being used by some other library if you place the
Beam class in a user-defined package.
Packages allow you to bundle collections of classes ...