I think you must use a java.io.BufferedReader (or a
java.io.InputStreamReader with a java.io.FileInputStream if you need
to process a special character encoding other than system default) to
read the file. You can use a java.io.StreamTokenizer to tokenize file
content. Then you can use a java.util.TreeMap to count the names. The
TreeMap.keySet() gives you the names and the value associated with
each key in the map can be an Integer showing the number of its
occurrences.