Forums Register Login

Need help with arrays

+Pie Number of slices to send: Send
Hi,

What is wrong with my code here?


+Pie Number of slices to send: Send
Index of an array starts with 0. Your array is of length 3. So the indexes of your array can be 0,1,2. In line 16, you try to access the index 3 ,which does not exist so it throws an ArrayIndexOutOfBoundsException.
lines 17,20,21 will throw ArrayIndexOutOfBoundsException for the same reason.

This will be helpful - https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html
+Pie Number of slices to send: Send
Thank you so much!!! It worked!!!
Crusading Chameleon likes the size of this 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 362 times.
Similar Threads
Arrays problem
Javabeat query
confusion in the output
Overloading wih static methods
small problem in java
More...

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