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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Formatting doubt" Watch "Formatting doubt" New topic
Author

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
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html#syntax


<a href="http://www.dantheman.pl" target="_blank" rel="nofollow">http://www.dantheman.pl</a>
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

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.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Formatting doubt