File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ExamLab Question - Formatting

 
Richa Sharma
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys

why does the output includes true in this examlab question?



Thanks
Richa
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4119
195
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, try this out:


Can you see the difference?
 
Richa Sharma
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got It Thanks Deveka
 
S Ali
Ranch Hand
Posts: 129
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because %b will print true for any non boolean type that is not null.
 
Fritz Guerilus
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought the answer would be:
07.00settrue
based:
on the flag being 0
and
the width being 2

But I compiled/executed the code and the answer is:
7.00settrue.

My question:
what happened to the flag & width ("%02...") portion of the format specifier?

-Thank You
 
Ankit Garg
Sheriff
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The %02. portion includes the width of the fractional part too, so it says that the minimum width of the number should be 2 including the part after the decimal point...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic