Introduction to Packages in Java | Core Java Free Tutorials

This Core Java Free Tutorials “Introduction to Packages in Java” is providing introduction to packages concept in java including definition of package, syntax of package and pre-defined library package structure.


 

Packages in Java:

  • package is a Java Folder or Directory.
  • package is a related group of classes, abstract classes and interfaces.
  • Creating folders is to combine the related information. So that we can access effectively.
  • Java API (library) is providing thousands of classes to implement Java applications easily.
  • Every class belongs to a specified pre-defined package.
  • Package naming convention “SINGLE WORD-SMALL CASE”. For example java, lang, net, util, io…..
  • “java” is the super package of all.

Library packages in Java

 

Note :

  • “lang” package is called default package in java.
  • “lang” package classes available directly to every java application.
  • These classes mainly used by basic java programmer for basic java application development.
  • System, String, Byte, Integer…. belongs to “lang” package….

 

Create User defined package:

  • “package” is the pre-defined keyword to create user-defined packages in java application.

 

Syntax :

package  <Identity> ;

Example :

package  nit ;

 

Note : Package statement must be the first statement in java source file.

Share this