title: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
body: <p>I am new to programming and while running some new code in eclipse, I came across this error and am completely lost.</p>
  
  <pre><code>import java.util.Scanner;
  
  public class Lab6
  {
      public static void main(String[] args)
      {
          // Fill in the body according to the following comments
      Scanner in= new Scanner(System.in); 
          // Input file name
          String FileName=getFileName(in);
          // Input number of students
          int numOfStudents = FileIOHelper.getNumberOfStudents(FileName);
          Student students[] = getStudents(numOfStudents); 
          // Input all student records and create Student array and
          // integer array for total scores
          int[]totalScores = new int[students.length];
          for(int i=0; i&lt; students.length; i++)
          {
              for(int j=1; j&lt;4; j++)
              {
                  totalScores[i]= totalScores[i]+students[i].getScore(j);
              }
          }
          // Compute total scores and find students with lowest and
          // highest total score
          int i;
          int maxIndex =0;
          int minIndex =0;
          for(i=0; i&lt;students.length; i++);
          {
              if(totalScores[i]&gt;=totalScores[maxIndex])
              {
                  maxIndex=i;
              }
              else if(totalScores[i]&lt;=totalScores[minIndex])
              {
                  minIndex=i;
              }
          }
  </code></pre>
  
  <p>problem seems to be in the line <strong>if(totalScores[i]>=totalScores[maxIndex])</strong></p>