• Main Menu
  • Java Package

    A Java package is a set of classes which are grouped together.

    This grouping helps to organize Java classes and codevent multiple Java classes with the same name.

    Using Java Packages

    To use a package in your Java source code, you must either import the package or use the fully qualified class name each time you use a class.

    Using Fully Qualified Class Names
    This example uses the Ammunition class from the ballistics package:

    ballistics.Ammunition caliber = new ballistics.Ammunition();

    As you can imagine, using fully qualified class names can become a bit of a hassle.
    Importing Classes
    import java.util.ArrayList; // Import the ArrayList class from the java.util package import java.util.*; // Import all public classes from the java.util package

    Optional Packages

    Optional Packages are packages of Java classes which are used to extend the core Java platform.

    Optional Packages are created by Java developers much like any other Java code. Optional Packages are then made available to the Java Virtual Machine.

    Java classes stored within Optional Packages can be used by the JVM without the need to be explicitly included in the CLASSPATH.

    Optional Packages are usually stored in JAR files.

    In earlier versions of Java, Optional Packages were known as Standard Extensions.

    Installed Optional Packages

    Installed Optional Packages are optional packages which have been copied into the JRE or JVM.

    JAR files containing Installed Optional Packages are copied into the lib/ext subdirectory.Optional Packages

    Download Optional Packages

    Download Optional Packages are optional packages which are loaded from outside the JRE/JVM file structure via a Class-Path header in a Manifest file.

    For more information on Optional Packages, read the Optional Package Overview.

    Got Something To Say:

    Your email address will not be published. Required fields are marked *

    1. agarkar suhas

      28 September, 2011 at 7:39 am

      you are good explain i am easy to understand

    2. mitchii

      17 June, 2011 at 2:23 pm

      this website really helps! :]
      i hope they will explain more clearer regarding of  java package too bad! its really hard for me to understand..

    181 queries in 0.570 seconds.