Java Reference
In-Depth Information
Package
In object oriented programming packages are used to hold and manage classes. Packages
themselves have no role in any programming. They are there only for management purposes.
Packages correspond to the role folders play in any operating system. Folders hold files so
that files are organized in the computer system and will make it easy to work with them.
Folders generally form a tree structure. In each branch of the folder there will be many files
as well as sub-folders.
Packages are organized also in tree structure. In one package there can be many class files as
well sub-packages. In Java programming, class files are saved with extension .java. These
;java files are source code files. The packages for Java files keep these .java files. For a small
software product you may need just one package. But for large software product which may
consist of hundreds of class files, you may need many packages. Basically you will create
packages to manage all those hundreds of class files.
Suppose you have created a package named my_package and have created a class file
my_class and put this class file into this package. In this case if you want to refer this class
file in some other class file then you can use my_package.my_class to access this class file.
The libraries which come with the programming language also consist of packages.
If you are using a good IDE (Integrated Development Environment) then through intellisen-
se you can find classes and methods inside a package. IDEs are the platform that software
development team uses to design and build the software product. Intellisense is a feature
available in most text editors included in IDEs. If you write a package name then the intel-
lisense will come up with a list of all classes inside that package. You can then choose the
class you want from this list. This makes sure that you dod not need to remember all the
classes inside a package. This job is done by the intellisense feature.
Search WWH ::




Custom Search