// // example of use of methods from Input class. // // observe notation "Input.methodname" to reference static methods. // public class TestFileInput { // reads two integers from file named by command-line argument, // then reads two more from standard input. public static void main(String[] args) { if (args.length == 0) { System.out.println("Missing argument.") ; System.exit(-1) ; } // set up to read from file rather than standard input Input.setFile(args[0]) ; int i = Input.readInt() ; int j = Input.readInt() ; System.out.println("Read from file: " + i + " " + j) ; // reset to read from standard input Input.setStdin() ; System.out.println("Enter two integers"); i = Input.readInt() ; j = Input.readInt() ; System.out.println("Read from stdin: " + i + " " + j) ; } }