aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Formatting doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Formatting doubt" Watch "Formatting doubt" New topic

Formatting doubt

sentil kumar
Ranch Hand

Joined: Oct 23, 2006
Posts: 74
System.out.printf("%1$010d, %s",1,111);

output is 0000000001, 1

but my expectedted result is 0000000001, 111

please explain this.
Dan Polak
Ranch Hand

Joined: Nov 06, 2006
Posts: 32

<a href="" target="_blank" rel="nofollow"></a>
Henry Wong

Joined: Sep 28, 2004
Posts: 19308

Not entirely sure, but this may be caused by your use of an argument index. I believe if you don't specify one, it will use some internal index, and that it increments for the next use. When you specified an argument index, it looks like this internal index doesn't change.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
rocket mass heater kickstarter
subject: Formatting doubt