// testing CS211In with File I/O public class CS211FileIOTest { public static void main(String[] args) { // Create file object from which to read tokens: CS211In inFile = new CS211In("test1.txt"); boolean exit = false; // flag to signal done // Process input: while(!exit) { // Check type of current token: switch( inFile.peekAtKind() ) { case CS211In.EOF: // end-of-file exit=true; // time to quit! break; case CS211In.INTEGER: System.out.println("Integer:" + inFile.getInt()); break; case CS211In.WORD: System.out.println("Word:" + inFile.getWord()); break; case CS211In.OPERATOR: System.out.println("Operator:" + inFile.getOp()); break; default: System.out.println("Unknown kind!"); } // end switch } // end while // Close the file! inFile.close(); } // method main } // class CS211FileIOTest