Source of MinusFlagTest.java


  1: // Fig 28.15: MinusFlagTest.java
  2: // Right justifying and left justifying values 
  3: 
  4: public class MinusFlagTest 
  5: {
  6:    public static void main( String args[] )
  7:    { 
  8:       System.out.println( "Columns:" );
  9:       System.out.println( "0123456789012345678901234567890123456789\n" );
 10:       System.out.printf( "%10s%10d%10c%10f\n\n", "hello", 7, 'a', 1.23 );
 11:       System.out.printf( 
 12:          "%-10s%-10d%-10c%-10f\n", "hello", 7, 'a', 1.23 );
 13:    } // end main 
 14: } // end class MinusFlagTest
 15: 
 16: /**************************************************************************
 17:  * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and               *
 18:  * Pearson Education, Inc. All Rights Reserved.                           *
 19:  *                                                                        *
 20:  * DISCLAIMER: The authors and publisher of this book have used their     *
 21:  * best efforts in preparing the book. These efforts include the          *
 22:  * development, research, and testing of the theories and programs        *
 23:  * to determine their effectiveness. The authors and publisher make       *
 24:  * no warranty of any kind, expressed or implied, with regard to these    *
 25:  * programs or to the documentation contained in these books. The authors *
 26:  * and publisher shall not be liable in any event for incidental or       *
 27:  * consequential damages in connection with, or arising out of, the       *
 28:  * furnishing, performance, or use of these programs.                     *
 29:  *************************************************************************/