• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Printf and formatting problem

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic