File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes C / C++ and the fly likes Issues in understanding the basics of the output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » C / C++
Bookmark "Issues in understanding the basics of the output" Watch "Issues in understanding the basics of the output" New topic
Author

Issues in understanding the basics of the output

Rachit Kumar Saxena
Ranch Hand

Joined: Dec 24, 2011
Posts: 50
Whenever I write:
printf("%3.1d",9);

I get:
9

but printf("%3.2d",9);

Gives:
09 as output.Why?Could anyone explain with the basics?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13875
    
  10

See the documentation for printf, which explains exactly what the format string means.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
 
subject: Issues in understanding the basics of the output
 
Similar Threads
Confusion about autoboxing
Array question - enthuware
Language doubt
Java loops- linear/log time- calculation
what will be the ans