title: Error with averaging program (Java), (Debugging)
body: <p>Of course I could have simply done everything in the main method, but that wouldn't help me practice the little I know with Java. So I made, or tried to make, an averaging program, where you input three variables, it calculates the average in a different method and returns the end result. Here is my code:</p>
  
  <pre><code>package test;
  import java.util.Scanner;
  
  public class testingclass {
      public static void main(String args[]){
          Scanner input = new Scanner(System.in);
  
          double[] grades = new double[3];
          System.out.println("Enter 3 grades you want to average out: ");
          grades[0] = input.nextDouble();
          grades[1] = input.nextDouble();
          grades[2] = input.nextDouble();
  
          display(grades);
          System.out.println(average);
  
      }
  
      public static double display(double[] x){
          double total = 0;
          for(int counter = 0; counter &lt; x.length; counter++){
              total = total + x[counter];
          }
  
          double average = total/x.length;
          return average;
      }
  }
  </code></pre>
  
  <p>So I have everything done, but now I don't know where to go, and when I did <code>System.out.println(average);</code> it told me that average wasn't a variable. Can someone help me with this?</p>