Forums Register Login

String.format problem

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
for 9.81 ,i am not getting any exception .It will print 10.
+Pie Number of slices to send: Send
 

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.
When you have exhausted all possibilities, remember this: you haven't - Edison. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 588 times.
Similar Threads
align output with StringBuffer
Display a integer always in two digit
String.format() problem
Printing two substrings
double
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 06:46:39.