I created this Multiple Choice program and everything is fine and the right answer is printing out but I keep getting:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 8 at MultipleChoices.main(MultipleChoices.java:21)
Can somebody tell me what I need to do to fix this error?
for(int i = 0; i < student[i].length; i++){
int rightAns = 0;
for(int j = 0; j < student[i].length; j++){
if(student[i][j].equalsIgnoreCase(key[j])){
rightAns++;
}
}