This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 14074
    
  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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Issues in understanding the basics of the output
 
Similar Threads
Language doubt
Confusion about autoboxing
what will be the ans
Array question - enthuware
Java loops- linear/log time- calculation