title: Java Method Call Array
body: <p>How do I pass an array from my main method to another method? I'm having an error with the parameters. Do I use the return value from main? And since the return value from main is an array, should the parameters for the call of main have brackets? Should there be a value between those brackets?</p>
  
  <pre><code>public class arraysAndMethods {
  
  public void printArray(double[] arr) {
      int x = arraysAndMethods.main(double[i] arr);//error with paremeters
      for (int i = 0; i &lt; studGrades.lenght; i++)
          System.out.print(studGrades[i] + " ");
  }// end of printArray method
  
  public static double[] main(String args[]){// double array
      java.util.Scanner input = new java.util.Scanner(System.in); // input scanner
      System.out.println("What is the size of the class?");
      int n = input.nextInt();
      double[] arr = new double[n];// declare and initialize array to have n many elements
      for (int i = 0; i &lt; arr.length;i++) {// input grades for each students
          System.out.println("What is the grade of student #" + (i+1));
          arr[i] = input.nextDouble();
      } // end of for loop
      return arr; 
  }// end of main method
  
  }// end of class
  </code></pre>