Common packages

The syntax of the import statement

import packagename.ClassName;

or

import packageName.*;

Examples:

  • import java.text.NumberFormat;
  • import java.util.Scanner;
  • import javax.swing.*;

Package Description
java.lang provides classes fundamental to Java, includes classes that work with primitive data.
java.text privides classes to handle text, dates, and numbers.
java.util provides various utility classes including those for working with collections.
java.io provides classes to read data from files and to write data to files.
java.sql provides classes to read data from databases and to write data to databases.
java.applet an older package that provides classes to create an applet