Provide Best Programming Tutorials

Package In Java

Package In Java

A package is a namespace that organizes a set of related classes and interfaces. Conceptually you can think of packages as being similar to different folders on your computer.

Package helps developer better organize the code.

Type of package

  • User-Defined package

  • Build-In package

Define a package

Syntax

package [package name]

Using the keyword package you can define a package.Let take a look at fixture below, here we define a package named com.zentut; and the class Hello is under this package.

Package can helps better organize the code as fixture below classes related to Array are under package arraydemo and classed about varialbe are under variabledemo package.

Actually package is translate to folder on OS as show below:

Build-In package

Leave a Reply

Close Menu