| Author |
Not able to understand the output
|
Abhilash Sharma
Ranch Hand
Joined: Dec 05, 2010
Posts: 67
|
|
Please tell me how these statement-:
System.out.printf("12%1$s","13%1$s","14%1$s"); and System.out.printf("12%1$s","13%1$s","14%1$s","15%1$s");
produce same output-:
1213%1$s
|
OCPJP 6 | OCEJWCD 6
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16692
|
|
Anishashu Sharma wrote:Please tell me how these statement-:
System.out.printf("12%1$s","13%1$s","14%1$s"); and System.out.printf("12%1$s","13%1$s","14%1$s","15%1$s");
produce same output-:
1213%1$s
Well, it becomes obvious by reading the documentation -- java.io.PrintStream and java.util.Formatter.
Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Abhilash Sharma
Ranch Hand
Joined: Dec 05, 2010
Posts: 67
|
|
|
Thanks.I got it.
|
 |
 |
|
|
subject: Not able to understand the output
|
|
|