I'm a beginner at java and would like to know how to process atextfile containing names using java.1. Counting the number of same names down the list.2. Printing out only the distinct names on the list with the countednumber from 1.
I think you must use a java.io.BufferedReader (or ajava.io.InputStreamReader with a java.io.FileInputStream if you needto process a special character encoding other than system default) toread the file. You can use a java.io.StreamTokenizer to tokenize filecontent. Then you can use a java.util.TreeMap to count the names. TheTreeMap.keySet() gives you the names and the value associated witheach key in the map can be an Integer showing the number of itsoccurrences.
Yup indeed, a 3rd party SDK is neccessary for you to process text file.