aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes why does this work with %s 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 "why does this work with %s " Watch "why does this work with %s " New topic
Author

why does this work with %s

Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531

why does this work with %s if i want to print only 123..is there any other way with &f?
Siva Masilamani
Ranch Hand

Joined: Sep 19, 2008
Posts: 385
%b and %s can work with any type of argument.

If you want to print 123 use %.0f


SCJP 6,SCWCD 5,SCBCD 5

Failure is not an option.
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
got the answer.......%s formats an object by calling its toString() method..hence 123.456 is converted into string and printed out......
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why does this work with %s