Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Issues in understanding the basics of the output

 
Rachit Kumar Saxena
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15359
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the documentation for printf, which explains exactly what the format string means.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic