June 2017
Beginner
1296 pages
69h 23m
English
... specifiers use the first argument in the argument list. Argument indices enable programmers to reorder the output so that the arguments in the argument list are not necessarily in the order of their corresponding format specifiers. Argument indices also help avoid duplicating arguments. Figure I.22 prints arguments in the argument list in reverse order using the argument index.
1 // Fig. I.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 ...Read now
Unlock full access