This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread 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 Elasticsearch in Action this week in the Big Data 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: 286
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
 
I agree. Here's the link: http://kickstarter.com/rocket-mass-heater
 
subject: String.format problem