Packages

Download java eBook

Introduction

package in java is used to group class and interfaces. This helps developer to avoid conflict when there are huge numbers of classes. If we use this package the classes we can create a class/interface with same name in different packages. By using packages we can import the piece of again in another class. There many built in packages in java like > 1.java.util > 2.java.lang > 3.java.io We can define our own user defined packages.

Remarks

Packages provide access protection.

package statement must be first line of source code. There can only be one package in one source file.

With help of packages conflict between different modules can be avoided.

Related Examples

Stats

48 Contributors: 2
Thursday, December 22, 2016
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook