Tag Archives: Reading

Reading from a file


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) {
} catch (IOException e) {

Please note the similarities between writing. The only difference is that here the FileReader is used in stead of the FileWriter.