Source of ArgumentIndexTest.java


  1: // Fig. 28.22: ArgumentIndexTest
  2: // Reordering output with argument indices.
  3: 
  4: public class ArgumentIndexTest 
  5: {
  6:    public static void main( String args[] ) 
  7:    {
  8:       System.out.printf( 
  9:          "Parameter list without reordering: %s %s %s %s\n", 
 10:          "first", "second", "third", "fourth" );
 11:       System.out.printf( 
 12:          "Parameter list after reordering: %4$s %3$s %2$s %1$s\n", 
 13:          "first", "second", "third", "fourth" );      
 14:    } // end main
 15: } // end class ArgumentIndexTest
 16: 
 17: /**************************************************************************
 18:  * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and               *
 19:  * Pearson Education, Inc. All Rights Reserved.                           *
 20:  *                                                                        *
 21:  * DISCLAIMER: The authors and publisher of this book have used their     *
 22:  * best efforts in preparing the book. These efforts include the          *
 23:  * development, research, and testing of the theories and programs        *
 24:  * to determine their effectiveness. The authors and publisher make       *
 25:  * no warranty of any kind, expressed or implied, with regard to these    *
 26:  * programs or to the documentation contained in these books. The authors *
 27:  * and publisher shall not be liable in any event for incidental or       *
 28:  * consequential damages in connection with, or arising out of, the       *
 29:  * furnishing, performance, or use of these programs.                     *
 30:  *************************************************************************/