File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Printf and formatting problem 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 "Printf and formatting problem" Watch "Printf and formatting problem" New topic
Author

Printf and formatting problem

Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634

In case of


Exception in thread "main" java.util.MissingFormatWidthException: -d



Exception in thread "main" java.util.MissingFormatWidthException: -,(d


the width is optional ,then why i am getting this exception


OCPJP 6.0 93%
OCPJWCD 5.0 98%
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
mohitkumar gupta wrote:
the width is optional ,then why i am getting this exception


You are trying to left-justify the numeric output, and in this situation, a width value is required. For more details, please check out the API as this is all spelled out there: http://java.sun.com/javase/6/docs/api/java/util/Formatter.html

Luck!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Printf and formatting problem