Hi, could someone tell me what's wrong.

The code works for the data set, answers but doesn't for data set answers2... the program crashes after displaying the data set2 and never gets data set 3, I will appreciate any help. Thanks.

```
import java.io.*;
import java.util.Scanner;
import java.util.*;
import java.lang.*;
public class Answers
{
public static void main (String[] args)
{
int[] student = { 1080, 1340, 1341, 1401, 1462, 1463, 1464, 1512, 1618, 1619, 1687, 1700, 1712, 1837 };
int[] student2 = { 2080, 1540, 1321, 5401, 1422, 1163, 1404 };
int[] student3 = { 7777 };
char[][] answer = { {'F','T','F','F','T','F','F','T','F','T'},
{'F','T','T','F','T','F','T','T','F','T'},
{'F','T','F','T','F','T','T','T','F','F'},
{'F','T','T','F','T','T','T','T','T','T'},
{'T','T','F','F','T','F','F','T','T','T'},
{'T','T','F','T','T','T','F','F','T','F'},
{'T','T','T','T','T','T','T','T','T','T'},
{'F','T','F','F','F','T','F','T','F','T'},
{'T','F','T','F','T','F','T','F','T','F'},
{'T','T','T','F','F','T','T','F','T','F'},
{'F','F','F','F','F','F','F','F','F','F'},
{'T','F','T','T','F','T','T','F','T','F'},
{'F','T','F','F','T','T','F','F','F','T'},
{'F','T','F','T','F','T','F','T','F','T'},
{'T','F','T','F','T','T','F','T','F','T'} };
char[][] answer2 = {{'F','T','F','F','T','F','F','T','F','T'},
{'F','T','T','F','T','F','T','T','F','T'},
{'F','T','F','T','F','T','T','T','F','F'},
{'F','T','T','F','T','T','T','T','T','T'},
{'T','T','F','F','T','F','F','T','T','T'},
{'T','T','F','T','T','T','F','F','T','F'},
{'T','T','T','T','T','T','T','T','T','T'},
{'F','T','F','F','F','T','F','T','F','T'} };
char[][] answer3 = { {'F','T','F','F','T','F','F','T','F','T'},
{'T','T','F','F','T','F','F','T','F','T'} };
/*Answers comp1130 = new Answers();
Answers comp1230 = new Answers();
Answers comp2120 = new Answers();*/
System.out.println ("Comp1130\n");
studentMarks (answer, student);
howManyGotEachQ (answer, student);
System.out.println ("Comp1230\n");
studentMarks (answer2, student2);
howManyGotEachQ (answer2, student2);
System.out.println ("Comp2120\n");
studentMarks (answer3, student3);
howManyGotEachQ (answer3, student3);
}//end of main method
/*public Answers ()
{
}*/
/*public Answers (char[][] answer, char[][] answer2, char[][] answer3, int[] student, int[] student2, int[] student3)
{
//Answers constructor
answer = new char[][] { {'F','T','F','F','T','F','F','T','F','T'},
{'F','T','T','F','T','F','T','T','F','T'},
{'F','T','F','T','F','T','T','T','F','F'},
{'F','T','T','F','T','T','T','T','T','T'},
{'T','T','F','F','T','F','F','T','T','T'},
{'T','T','F','T','T','T','F','F','T','F'},
{'T','T','T','T','T','T','T','T','T','T'},
{'F','T','F','F','F','T','F','T','F','T'},
{'T','F','T','F','T','F','T','F','T','F'},
{'T','T','T','F','F','T','T','F','T','F'},
{'F','F','F','F','F','F','F','F','F','F'},
{'T','F','T','T','F','T','T','F','T','F'},
{'F','T','F','F','T','T','F','F','F','T'},
{'F','T','F','T','F','T','F','T','F','T'},
{'T','F','T','F','T','T','F','T','F','T'} };
answer2 = new char[][] { {'F','T','F','F','T','F','F','T','F','T'},
{'F','T','T','F','T','F','T','T','F','T'},
{'F','T','F','T','F','T','T','T','F','F'},
{'F','T','T','F','T','T','T','T','T','T'},
{'T','T','F','F','T','F','F','T','T','T'},
{'T','T','F','T','T','T','F','F','T','F'},
{'T','T','T','T','T','T','T','T','T','T'},
{'F','T','F','F','F','T','F','T','F','T'} };
answer3 = new char[][] { {'F','T','F','F','T','F','F','T','F','T'},
{'T','T','F','F','T','F','F','T','F','T'} };
student = new int[] { 1080, 1340, 1341, 1401, 1462, 1463, 1464, 1512, 1618, 1619, 1687, 1700, 1712, 1837 };
student2 = new int[] { 2080, 1540, 1321, 5401, 1422, 1163, 1404 };
student3 = new int[] { 7777 };
}//end of constructor*/
public static void studentMarks (char[][] ans, int[] stud)
{
//This method calculates and diplays the marks for each student.
int correct = 0;
final int STUDENTS = ans.length - 1;//calculates the number of students
int[] mark = new int[STUDENTS];//creating an array to store the number of correct answers for each student
for (int i=1; i<ans.length; i++)
{
for (int j=0; j<ans[i].length; j++)
{
if ((ans[i][j]) == (ans[0][j]))
correct++;
}
mark[i-1] = correct;//stores the mark in the mark array
correct = 0;//resets the counter; sets it to 0
}
displayMarks (ans[0].length, stud, mark);//sends the computed data to the display method.
}
public static void displayMarks (int ans, int[] stud, int[] holdMarks)
{
//This method displays the student numbers and the mark each student got.
System.out.println ("Student#\tMark(out of " +ans +")");
for (int i=0; i<holdMarks.length; i++)
{
System.out.print (" " +stud[i] +"\t\t\t " +holdMarks[i] +"\n");
}
}
public static void howManyGotEachQ (char[][] ans, int[] stud)
{
//This method calculates and diplays how many students got each question right and the correct answer for each question.
int correct = 0;
int incorrect = 0;
final int STUDENTS = ans[0].length;//calculates the number of questions
int[] cor = new int[STUDENTS];//creating an array to store the number of correct answers for each student
int[] incor = new int[STUDENTS];//creating an array to store the number of correct answers for each student
for (int i=1; i<=ans[0].length; i++)
{
for (int j=0; j<ans[0].length; j++)
{
if ((ans[i][j]) == (ans[0][j]))
correct++;
else
incorrect++;
}
cor[i-1] = correct;//stores the correct number of answers in the cor array
incor[i-1] = incorrect;//stores the incorrect number of answers in the incor array
correct = 0;//resets the correct counter; sets it to 0
incorrect = 0;//resets the incorrect counter; sets it to 0
}
displayQM (ans[0], cor, incor);//sends the computed data to the display method
}
public static void displayQM (char[] correct, int[] holdCor, int[] holdIncor)
{
//This method displays the number of correct and incorrect answers for each question.
System.out.println ("\nQuestion\tCorrect\t Number\t Number");
System.out.println ("Number\t\tAnswer\t Correct Incorrrect");
for (int i=1; i<=correct.length; i++)
{
if (i<10)
System.out.print (" " +(i) +"\t\t\t " +correct[i-1] +"\t\t" +holdCor[i-1] +"\t\t" +holdIncor[i-1] +"\n");
else//the else statement removes the extra spaces that results from the number 10, hence helping with formatting
System.out.print (" " +(i) +"\t\t " +correct[i-1] +"\t\t" +holdCor[i-1] +"\t\t" +holdIncor[i-1] +"\n");
}
}
}//end of Answers class
```