Forums Register Login

ArrayIndexOutOfBoundException...

+Pie Number of slices to send: Send
Dear folks
The following program works fine but when i try to calculate the average of the int arrays it gives the 'arrays out of bound exceptions'.
Could anybody helps me how to rectify this problem. Or suggest me how can i calculate the average of int arrays in the last of my output.
Thanks in advance.
+Pie Number of slices to send: Send
Simple..
problem is with your statement
average += randomNo[ i ] ;
is out side the loop and i at that time is 12 !!!.
Put it inside the loop.
+Pie Number of slices to send: Send
Great! thanks it's solved.
I was doing so with sum but not with average.
It's perfectly running now.
Thanks again.
Raashed
Can you smell this for me? I think this tiny ad smells like blueberry pie!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 899 times.
Similar Threads
int cannot be derefrenced
problem with array
Java Random
Need some help to put me in the right direction
Extract all integers from a text file, how to do?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 22:27:13.