I just started Java programming. I am trying to create a class method that will use an array in the same class in a for loop. But a NullPointerException is thrown when I try to run the program. Could anyone please point out what is wrong here? Thank you!
public class Judge {
    double [] judgeScoreArray;
    double judgeMean = getMean();
    //Method to calculate mean of an array
    public double getMean(){
        double sum = 0;
        //***NullPointerException Thrown at the next line***
        for (int i = 0; i <judgeScoreArray.length; i++){ 
        sum = sum + judgeScoreArray[i];
        }
        return sum/((judgeScoreArray.length));
    }
    public Judge(){
    judgeScoreArray = new double [7];
    for (int i = 0; i < 7; i++){
        judgeScoreArray[i] = 0;
    }
}
