How do you read the contents of a file into an ArrayList in Java?
ArrayList
Here are the file contents:
cat ho
List words = new ArrayList(); BufferedReader reader = new BufferedReader(new FileReader("words.txt")); String line; while ((line = reader.readLine()) != null) { words.add(line); } reader.close();