Packages in java

Packages

A package is a group of related classes, interfaces, enumeration and annotation and provide access protection and namespace management.

Some of the existing packages are-

Java.lang -collection of fundamental classes

Java.io -classes for input, output functions are collected in this group.

A programmer can define their own packages to bundle a group of classes/interfaces etc.

Creating a package:

For the creation of the package, we should choose a name for the package and include a package statement along with that name at the top of every source file that contains classes, interfaces, enumeration and annotation types that you want to include in the package.

Packaging naming conventions:

Packages have reverse order domain names. e.g college.art.history.


Last updated:9/7/2018 5:02:05 AM
Anonymous User

Anonymous User

I am a content writter !

0 Comments

Leave Comment