package CountLetter;
import java.io.*;

public class CountLetter {
    public static int getCount(char c, File f) throws Exception {
        int count = 0;
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(f)))) {
            String line;
            while ((line = reader.readLine()) != null) {
                for (int i = 0; i < line.length(); i++) {
                    if (c == line.charAt(i)) count++;
                }
            }
        }
        return count;
    }
    public static void main(String[] args) throws Exception {
        File file = new File("test.txt");
        System.out.println("'a'의 횟수: " + getCount('a', file));
    }
}
