Specifications
Sun Services
Java™ Programming Language
Module 9, slide 21 of 37
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
File Stream I/O
A file input example is:
1 import java.io.*;
2 public class ReadFile {
3 public static void main (String[] args) {
4 // Create file
5 File file = new File(args[0]);
6
7 try {
8 // Create a buffered reader
9 // to read each line from a file.
10 BufferedReader in
11 = new BufferedReader(new FileReader(file));
12 String s;
13










