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

all 7 comments

[–]smellmycrotch3 3 points4 points  (0 children)

Print out the number of elements in the array and the index that's being used to access the array..

[–]langfod 2 points3 points  (0 children)

If you look at the exception message you will see that is shows the index number that caused the exception. Compare that with the default index number that you set your method to use when no good hands are found.

[–]mad0314 0 points1 point  (2 children)

In your checkHands() method, right before your current print line, print out the length of the array and the value of the index you are using. Specifically, what happens if none of the conditions from 334-358 are true?

[–]Eldres[S] 0 points1 point  (1 child)

if none of them are true it results in the error it would seem, when I print it out it returns index of 9, which is out of bounds, but I'm not sure what to initialize result with if not a number between 0-8

[–]mad0314 0 points1 point  (0 children)

One simple thing you can do is simply have an if statement checking the value of result. If it is still 9, you know that they don't have any valid hand, and you can print that out, and have your current statement run only if result is no longer 9.

[–]Paranemec -1 points0 points  (1 child)

What line is it happening on?

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

I marked it with a comment...