Imagine you have two classes, one of which represents a component
that reads data from the console. Simiarly, the other class represents a device
which scans papers. Although both the classes are different in functionality,
both the classes can be named Scanner
. So far, you have learnt that you cannot
declare two classes with the same name. An obvious solution is to name these
classes differently.
However, Java provides a feature known as package that allows you to create classes, interfaces, enumerations, and annotations with the same name.
In this chapter, you will learn about declaring packages, importing packages,
and the infamous CLASSPATH
environment variable.