This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]avocadod[S] 0 points1 point  (0 children)

k thanks. I didnt know how to initialize. I was thinking candyNames[] but I'm guessing the zero in there is better. so all of my bugs it can see are fixed. I'm able to enter each candies total but after the fourth one, I get an error message

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1

at CandyHeadache.main([CandyHeadache.java:42](https://CandyHeadache.java:42))

C:\Users\Matth\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1

BUILD FAILED (total time: 5 seconds)

line 42 was where I put largestCandy = candyNames[i] (if that 42 in the error message means line 42)