title: trouble defining array locally and passing parameters to other methods
body: <p>My assignment was to write a Java class that creates an array of integers, fills it with values, prints the unsorted values, sorts the values into ascending order, and finally prints the sorted values.</p>
  
  <p>For the most part I have done that and my output is fine. However I have not been able to define the array locally within the main(), and pass it as a parameter to the other methods.
  I try to define it as a static member of the class which cannot be done. </p>
  
  <p>Can anyone help me out? I need to define the array in the main() and pass it as a parameter to the methods. But I just cannot figure it out despite tireless research.</p>
  
  <p>Here is what I have so far.</p>
  
  <pre><code>public class ArraySort {
  private static Object sc;
         int[] array;
  
  // creates question and int for user input
  /**
   *
   */
  public void fillArray() {
      Scanner keyboardScanner = new Scanner(System.in);
      System.out.println("Enter the size of the array (3 to 10): ");
      int n = keyboardScanner.nextInt();
      array = new int[n];
  
      // creates new question by including int 
      System.out.println("Enter " + n + " values" );
  
      // creates for loop for repeating question based on array size 
      for (int i=0; i&lt;n; i++) {
          System.out.println("Enter value for element " + i + ": ");
      array[i] = keyboardScanner.nextInt();
      }
  }
  
  // prints i in the for loop
  public void printArray(String msg) {
      System.out.println(msg);
      for (int i=0; i&lt;array.length; i++) {
          System.out.println(array[i]);
      }
  }
  
  //  defines method
  public void sortArray() {
      // sets up to output in ascending order
      for (int i=0; i&lt;array.length; i++) {
          for (int j=i+1; j&lt;array.length; j++) {
              if (array[i] &gt; array[j]) {
                  int temp = array[i];
                  array[i] = array[j];
                  array[j] = temp;
              }
          }
      }
  }
  
  
  
  // main output and visual layout
  public static void main(String[] args) {
      ArraySort arraySort = new ArraySort();
      arraySort.fillArray();
  
  
      System.out.println();
      arraySort.printArray("The unsorted values... ");
      arraySort.sortArray();
      System.out.println();
      arraySort.printArray("The sorted values... ");
  
  
  
  
      // Keep console window alive until 'enter' pressed (if needed).
      System.out.println();
      System.out.println("Done - press enter key to end program");
  
  
  
   }
  }
  </code></pre>
  
  <p>I have no errors, I just need help on how to define the array locally in the main() </p>
  
  <p>Thanks.</p>