import
The import statements are directions to the compiler as to where
to find a class (or group of classes).
Examples:
Static imports:
import static java.lang.System.*;
This allows you to leave off the System.
when accessing members of the System class.
You can now do out.println("Yeah");
instead of System.out.println("Boo");
import static java.lang.Math.*;
This allows you to leave off the Math.
when calling methods of the Math class.
You can now do abs(x) instead of Math.abs(x), etc.
Sample imports:
// tells the compiler where to find the Scanner class
import java.util.Scanner;
// tells the compiler where to look to find the io classes
import java.io.*;
// tells the compiler where to look to find the ArrayList class
import java.util.ArrayList;
// tells the compiler where to find the Color class
import java.awt.Color;
// tells the compiler where to find the gui components and other
// related classes used to write a window style program
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;