Java Packages (Cont.)


Java packages are divided into two categories: Built-in Packages
Predefined packages are developed by SUN Microsystems and supplied as a part of JDK (Java Development Kit) to simplify the Java programmers’ works: These packages consist of a large number of classes which are a part of Java API (Application Programming Interface).


To use a class or a package from the library, you need to use the import keyword. You can either import a single class (along with its methods and attributes), or a whole package that contains all the classes that belong to the specified package:

 import package.name.Class;     // Import a single class.
 import package.name.*;         // Import the whole package.