I am trying to write a static method named marksToGrades that takes an array of marks (double) between 1 and 100 as a parameter and returns a String array containing the corresponding grade.

[![enter image description here](https://i.stack.imgur.com/BLwpU.jpg)](https://i.stack.imgur.com/BLwpU.jpg)

```
public static String[] marksToGrades(double[] array){
    double[] grades;
    for (int i = 0; i < array.length; i++){
    if (array[i] >= 80 && array[i] <= 100)
        array[i] = "A";
    else if (array[i] >= 65 && array[i] < 80)
        array[i] = "B";
    else if (array[i] >= 50 && array[i] < 65)
        array[i] = "C";
    else if (array[i] >= 0 && array[i] < 50)
        array[i] = "D";
    else array[i] = "Invalid";
    } 
    return grades;
}

```

This the following error I am getting, but I am unsure on how to fix this.

[![enter image description here](https://i.stack.imgur.com/9F42L.jpg)](https://i.stack.imgur.com/9F42L.jpg)

Any help would be much appreciated. Thank you.

**Update**

```
public static String[] marksToGrades(double[] array){
    String[] grades;
    for (int i = 0; i < array.length; i++){
    if (array[i] >= 80 && array[i] <= 100)
        grades[i] = "A";
    else if (array[i] >= 65 && array[i] < 80)
        grades[i] = "B";
    else if (array[i] >= 50 && array[i] < 65)
        grades[i] = "C";
    else if (array[i] >= 0 && array[i] < 50)
        grades[i] = "D";
    else grades[i] = "Invalid";
    } 
    return grades;
}

```

[![enter image description here](https://i.stack.imgur.com/zotLs.jpg)](https://i.stack.imgur.com/zotLs.jpg)