// Allison Obourn // CSE 143 - lecture 1 // prints out tokens from a file in reverse order import java.util.*; import java.io.*; public class Reverse { public static void main(String[] args) throws FileNotFoundException { ArrayList allWords = new ArrayList(); Scanner input = new Scanner(new File("words.txt")); while(input.hasNext()) { String word = input.next(); allWords.add(word); } for(int i = allWords.size() - 1; i >= 0; i--) { System.out.println(allWords.get(i)); } } }