Below is the syntax highlighted version of MaxMin.java.
/************************************************************************* * Compilation: javac-introcs MaxMin.java * Execution: java-introcs MaxMin * [input required from standard input ] * [ use ctl-d (OS/X) or ctl-z (Windows) for EOF ] * * Dependencies: StdIn.java, StdOut.java * * Read in integers from standard input * and print out the maximum and minimum values read in. * * % java-introcs MaxMin * 23 45 17 56 32 * 89 10 53 32 34 * 16 * ctl-d * maximum = 89, minimum = 10 * (Ex. 1.5.1) *************************************************************************/ public class MaxMin { public static void main(String[] args) { // first value read initializes min and max int max = ; int min = ; // read in the data, keep track of min and max while ( ) { int value = StdIn.readInt(); } // output StdOut.println("max = " + max + " min = " + min); } }