This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes String.format problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "String.format problem" Watch "String.format problem" New topic
Author

String.format problem

Surasak Leenapongpanit
Ranch Hand

Joined: May 10, 2002
Posts: 341
Hi, all

Why the below throws java.lang.ArrayIndexOutOfBoundsException.



when I change the value from 9.81 to 12.81, it run without exception.

Thank you,
Surasak Leenapongpanit
raj malhotra
Ranch Hand

Joined: Feb 22, 2007
Posts: 285
for 9.81 ,i am not getting any exception .It will print 10.
Shaan Shar
Ranch Hand

Joined: Dec 27, 2005
Posts: 1249

Originally posted by Surasak Leenapongpanit:
Hi, all

Why the below throws java.lang.ArrayIndexOutOfBoundsException.



when I change the value from 9.81 to 12.81, it run without exception.

Thank you,
Surasak Leenapongpanit



When I tried, It's giving perfect solution i.e 13.

Just check the whole code once again or you can paste the code over here. SO that we can look into this issue.


The Best way to predict your future is to create it - Every great individual common man
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: String.format problem