• Packages are java’s way of grouping a variety of classes and/or interface together.
  • The grouping is usually done according to functionality.In fact, packages act as “containers” for classes.
  • Benefits of packages:-
  • The classes contained in the packages of other program can be easily reused.
  • In packages, classes can be unique compared with classes in other packages.That is ,two classes in two different packages can have the same name.They may be referred by their fully qualified name, comprising the package name and the class name.
  • Packages provides a way to hide classes thus preventing other programs or packages from accessing classes that are meant for internal use only.
  • Java API Packages

  • java.lang – Language support classes.They includes classes for primitive types, strings , math functions , threads and exceptions.
  • java.util – Language utility classes such as vector , hash tables , random numbers , date , etc.
  • – Input/Output support classes. They provide facilities for the input and output of data.
  • java.awt – Set of classes for implementing graphical user interface . They include classes for windows, buttons , lists , menu and so on.
  • – Classes for networking. They includes classes for communicating with local computers as well as with internet servers.
  • java.applet – Classes for creating and implementing applets.They includes color,font,graphic ,etc.

Creating Packages