Skip to main content

Posts

Showing posts with the label packages

JAVA : W1-M5

Packages Learning Objective * Package Concepts in Java Orientation Video Introduction Packages: Multiple classes of larger programs are usually grouped together into a package. Packages correspond to directories in the file system, and may be nested just as directories are nested. Package = directory. Reasons to use packages • Grouping related classes. • To allow classes to be combined in a single ".jar" file. • To control the namespace. • To limit the scope of names. Grouping related classes. If you are writing a normal one-programmer application, it will typically be in one package. The purpose of a package is to group all related classes together. If you are working on a program that is divided into separate sections that are worked on by others, each section might be in its own package. This prevents class name conflicts and reduces coupling by allowing package scope to be used effectively. Package declarations: Each file may have a ...