I understand the reason behind this exception and I checked my code multiple times. However, I think my index is within the index bound. Can anyone help me out here? Just a side note: assume the condition for while loop will be satisfied. That is, num is at most 3.
int suit;
int num = 0;
String[] suitList = {"c", "d", "h", "s"};
for (int i = 0; i < 5; i++){
while (suitList[num].equals(testHand[i].substring(0,1)) == false){
num++;
}
suit = num + 1;
}