June 2017
Beginner
1296 pages
69h 23m
English
...
1 // Fig. I.2: IntegerConversionTest.java
2 // Using the integer conversion characters.
3
4 public class IntegerConversionTest
5 {
6 public static void main(String[] args)
7 {
8 System.out.printf("%d\n", 26);
9 System.out.printf("%d\n", +26);
10 System.out.printf("%d\n", -26);
11 System.out.printf("%o\n", 26);
12 System.out.printf("%x\n", 26);
13 System.out.printf("%X\n", 26);
14 } // end main
15 } // end class IntegerConversionTest
26 26 -26 32 1a 1A
The printf method has the form
printf(format-string, argument-list);
where format-string describes the output format, and the optional argument-list contains the values that correspond to each format specifier in format-string. There can be many format specifiers in one format string. ...
Read now
Unlock full access