Source of Maximum.java


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