Source of Maximum.java


  1: /* 
  2:  * Copyright (c) 1999-2002, Xiaoping Jia.  
  3:  * All Rights Reserved. 
  4:  */
  5: 
  6: /**
  7:  *  This program prints out the maximun of the two intergers supplied as command-line arguments
  8:  */
  9: public class Maximum {
 10: 
 11:   public static void main(String[] args) {
 12:     if (args.length >= 2) {
 13:       int i1 = Integer.parseInt(args[0]); 
 14:       int i2 = Integer.parseInt(args[1]); 
 15:       System.out.println("The maximum of " + i1 + " and " + i2 + " is: " + 
 16:                          ((i1 >= i2) ? i1 : i2));          
 17:     } else {
 18:       System.out.println("Usage: java Maximum integer1 integer2");
 19:     }
 20:   }
 21: 
 22: }
 23: