Q:

How to return an array from a static method?

I am in my first week of computer programming, and I need to figure out how to return an array to main. I want the outer for-loop to repeat the inner for the two input types (assignment and lab), then I want to return the average assignment and average lab value as an array to main. 
import java.util.stream.*;
import java.util.Scanner;

public class Gr {
    public static void main(String [] args) {

    }

    public static void taskAvg() {
        Scanner stdin = new Scanner(System.in);
        int numberOfTasks = 7;
        String typeOfTask = "Assignment";
        int taskTotal = 10;
        double[] taskGrades = new double[11];

        for (int i = 1; i <=2; i++) {
            System.out.println("\nInput " + typeOfTask + " (maximum " + taskTotal + ")");
            for (int j = 1; j <= numberOfTasks; j++) {
                System.out.print(" #" + j + "==>");
                taskGrades[j] = stdin.nextDouble();
                if (taskGrades[j] > taskTotal || taskGrades[j] < 0) {
                    System.out.println("Oops! That's not right. Please try again.");
                    System.out.print(" #" + j + "==>");
                    taskGrades[j] = stdin.nextDouble();
                }
            }
            double taskSum = DoubleStream.of(taskGrades).sum();
            double taskAverage = taskSum / numberOfTasks;
            numberOfTasks = 10;
            typeOfTask = "lab";
            taskTotal = 1;
        }
    }
}

A:

First you need to change the type of your function to return an array. 
public static double[] taskAvg(){
    double[] taskGrades = new double[11];

    ... // Do your stuff

    return taskGrades;
}

And then you need to assign the value to a variable in main.
public static void main(String [] args) {
    double[] result = taskAvg();
}

