aspose 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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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: 14114
    
  16

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
 
Consider Paul's rocket mass heater.
 
subject: Issues in understanding the basics of the output