Introduction
Similar to writing to files we can also read from a file. This is done as follows:
try { BufferedReader in = new BufferedReader(new FileReader("infilename")); String str; while ((str = in.readLine()) != null) { process(str); } in.close(); } catch (IOException e) { }
Please note the similarities between writing. The only difference is that here the FileReader is used in stead of the FileWriter.