DigitCounter.java Source code

Java tutorial

Introduction

Here is the source code for DigitCounter.java

Source

import java.io.FileReader;

class DigitCounter {

    public static void main(String args[]) throws Exception {

        // Create a file reader
        FileReader fr = new FileReader(args[0]);

        // Read characters
        int i;
        while ((i = fr.read()) != -1) {
            System.out.println((char) i);

        }

        // Close file reader
        fr.close();
    }
}