This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question on format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Question on format" Watch "Question on format" New topic
Author

Question on format

Tayitu Betule
Ranch Hand

Joined: Dec 18, 2009
Posts: 39
Why is the following code prints "true false" and not "false false"?



Thank you all.
Kaspar Christenson
Greenhorn

Joined: Feb 26, 2009
Posts: 21

The Formatter %b conversion documentation states
If the argument arg is null, then the result is "false". If arg is a boolean or Boolean, then the result is the string returned by String.valueOf(). Otherwise, the result is "true".


Since you're formatting a String the result is "true".
Tayitu Betule
Ranch Hand

Joined: Dec 18, 2009
Posts: 39
Thank you Kaspar. That was an oversight on my side.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Question on format
 
It's not a secret anymore!