خواندن اطلاعات از یک فایل :
import java.io.*;
public class Words {
public static void main(String[] args)
throws FileNotFoundException, IOException {
processFile(“words.txt”);
}
public static void processFile(String fileName)
throws FileNotFoundException, IOException {
FileReader fileReader = new FileReader(fileName);
BufferReader in = new BufferReader(fileReader);
while (true) {
String s = in.readLine();
if (s == null) break;
System.out.println(s);
}
}
}