import java.util.Scanner; import java.io.File; import java.io.IOException; import java.util.ArrayList; public class ScannerFromFileDemo { public static void main(String[] args) throws IOException { Scanner file = new Scanner(new File("words.txt")); String adjective = ""; String noun = ""; String verb = ""; String adverb = ""; adjective = file.next(); noun = file.next(); verb = file.next(); adverb = file.next(); System.out.println("The " + adjective + " " + noun + " " + verb + " " + adverb); // later in this Java course, you'll study ArrayLists Scanner dictionary = new Scanner(new File("dictionary.txt")); ArrayList wordList = new ArrayList(); while (dictionary.hasNext()) { wordList.add(dictionary.next()); } for (String nextWord: wordList) { System.out.println(nextWord); } } }