Before you can do anything with the
FileInputStream
classes, you must inform Java that you wish to use
classes defined in a group of classes called the inputoutput
package, also known as the java.io
package.
In general, if you want to use a particular class in a particular package,
then you inform Java that you want that class by including an
import
statement,
such as the following, in your class definition:
*-- Include a class from the i/o package | | *-- Include the FileInputStream class v v ------- --------------- import java.io.FileInputStream;
Alternatively, if you want to tell Java to be prepared to use any class
in a particular package, then you include an asterisk, instead of a class
name, in the import
statement:
*-- Include a class from the i/o package | | *-- Include all classes in the package v | ------- v import java.io.*;
The advantage of using an asterisk is that you can cover all the classes from a single package in one statement; the disadvantage is that your compiler may do its work more slowly.