import java.io.*
// open the file "outfile.txt" and connect pStream to it for output:
PrintWriter pStream = new PrintWriter(
new File("outfile.txt"));
// Now we can send output to the file:
pStream.println("Hello File");
pStream.close(); // and close it.
throws IOException
String lineIn;
// open the file "infile.txt" and connect iStream to it for output:
Scanner iStream = new Scanner(new File("infile.txt"));
// Now we can get input from the file:
lineIn = iStream.nextLine();
iStream.close(); // and close it.
import java.io.* and:
throws IOException