This website is for sell contact:- +919827974760 Java Package Tutorial with Example
  • JSP
  • PHP
  • JavaScript
  • Struts
  • SQL Tutorial
  • jQuery
  • Spring
  • Core Java
  • Servlet

  • <

    What is Java Package ?

    Java Package join a group of related classes, sub packages and interfaces. Java Package are used for:

  • Preventing naming conflicts.

  • Providing controlled access

  • It also considered as data encapsulation.

  • How to Create a Package

    Choose name of the package and destination folder.

    The package statement must be in the first line .Should be one package statement in each source file.

    Create Package Syntax
    javac -d folder_name

    Java Package Example

    package pack;   
    public class A{   
      public void msg(){System.out.println("Hello");
    //save by   
    package mypack;   
    import pack.*;   
    class B{   
      public static void main(String args[]){   
       A obj = new A();   


    © copyright 2017-2022 Completedone pvt ltd.