public class OtherConversion
1: // Fig. 28.11: OtherConversion.java
2: // Using the b, B, h, H, % and n conversion characters.
3:
4: public class OtherConversion
5: {
6: public static void main( String args[] )
7: {
8: Object test = null;
9: System.out.printf( "%b\n", false );
10: System.out.printf( "%b\n", true );
11: System.out.printf( "%b\n", "Test" );
12: System.out.printf( "%B\n", test );
13: System.out.printf( "Hashcode of \"hello\" is %h\n", "hello" );
14: System.out.printf( "Hashcode of \"Hello\" is %h\n", "Hello" );
15: System.out.printf( "Hashcode of null is %H\n", test );
16: System.out.printf( "Printing a %% in a format string\n" );
17: System.out.printf( "Printing a new line %nnext line starts here" );
18: } // end main
19: } // end class OtherConversion
20:
21: /**************************************************************************
22: * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and *
23: * Pearson Education, Inc. All Rights Reserved. *
24: * *
25: * DISCLAIMER: The authors and publisher of this book have used their *
26: * best efforts in preparing the book. These efforts include the *
27: * development, research, and testing of the theories and programs *
28: * to determine their effectiveness. The authors and publisher make *
29: * no warranty of any kind, expressed or implied, with regard to these *
30: * programs or to the documentation contained in these books. The authors *
31: * and publisher shall not be liable in any event for incidental or *
32: * consequential damages in connection with, or arising out of, the *
33: * furnishing, performance, or use of these programs. *
34: *************************************************************************/