This is for a homework assignment, for a game of Hangman. Now, I got the whole game working except for this part. Reading the dictionary list that the teacher provided.
public static void main(String[] args) throws FileNotFoundException {
Scanner fileScan = new Scanner(new File(words.txt));
List<String> dictionary = new ArrayList<String>();
while (fileScan.hasNext()) {
dictionary.add(fileScan.nextLine().toLowerCase());
}
for( int i = 0; i < dictionary.size(); i++) {
System.out.println(dictionary.get(i));
}
}
I separated this part from the code to be able to test it. I also made the dictionary file into just 5 words. When I hit run, it doesn't print out anything. Just a blank space.