A library is a collection of already written useful pieces if program, kept in files. Generally a Java program will need to use some code in a library to for instance display the results or perform some calculations.

To use a library it must be imported with an import statement at the start of the program.

Libraries that we will us often are the java.awt. library which contains tools to display output and the java.applet.Applet library which contains code for applets. Another library we will use is the java.awt.Event library.

For this reason most of our applet programs will start with the commands

import java.awt.*;
import java.applet.Applet;

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License