Source of ZeroFlagTest.java


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