Array initialization error
<p>I am doing java programming practice from a website. I have to display this out put using arrays.</p>

<pre><code>Enter the number of students: 3
Enter the grade for student 1: 55
Enter the grade for student 2: 108
Invalid grade, try again...
Enter the grade for student 2: 56
Enter the grade for student 3: 57
The average is 56.0
</code></pre>

<p>This is my source code so far, it is raising error <code>The local variable grades may not have been initialized</code>. How do I recover this? I have to make this program using arrays.</p>

<pre><code>package array;

import java.util.Scanner;

public class GradesAverage {

    public static void main(String[] args) {

        int numStudents = 0;
        int[] grades;

        Scanner in = new Scanner(System.in);

        System.out.print("Enter number of students : ");
        numStudents = Integer.parseInt(in.next());

          for (int i = 0; i &lt; numStudents; i++) {
              System.out.print("Enter grade of student "+i+" :");
              grades[i] = Integer.parseInt(in.next());
        }

    }

}
</code></pre>
