what is package in java

what is package in java :-

  • In java package is similar to a directory and the directory contain the subdirectory and file.
  • Package contain sub packages and class file.
  • In technical word package encapsulate /file  class file, According to the functionality .

               Example :-

                      net - This package is use for net working.
                      sql - This package is use for web function.
                      io - This package is use for input and output.

    what is package in java


  • Types of Package :-

Package is 2 types.

  1. System defined package (It encapsulate the system defined class file).
      2. User defined package (It encapsulate the user defined class file).

  • When we declare the package in java ,the package name is similar to directory name.
EX :-
           D:\P1:>
          package p1;

Program for package :-

what is package in java

Here LIPU is the package and also LIPU is the directory name .

for more detail follow my Instagram id - https://www.instagram.com/asitmaharana10/

Thank you.