// LargeintWithMath.java (c) 2005 Kari Laitinen // http://www.naturalprogramming.com // 2005-05-04 File created. // 2005-05-04 Last modification. // This program works like Largeint.java in javafiles2, // but this one is implemented by using the Math.max() method. import java.util.* ; class LargeintWithMath { public static void main( String[] not_in_use ) { Scanner keyboard = new Scanner( System.in ) ; System.out.print( "\n This program can find the largest of three" + "\n integers you enter from the keyboard. " + "\n Please, enter three integers separated " + "\n with spaces : " ) ; int first_integer = keyboard.nextInt() ; int second_integer = keyboard.nextInt() ; int third_integer = keyboard.nextInt() ; int found_largest_integer = Math.max( first_integer, second_integer ) ; found_largest_integer = Math.max( found_largest_integer, third_integer ) ; System.out.print( "\n The largest integer is " + found_largest_integer + ".\n" ) ; } }