title: How to change an array in a different method?
body: <p>I wanted to have a method that makes an array and a method that changes the array (the 13 into a 6 and add 2 on the fourth item) and then catch both the changed and unchanged arrays in variables, but I can't seem to call the changed array in the main, without there being an error</p>
  <pre class="lang-java prettyprint-override"><code>public class ArrayFillApp {
  
      public static void main(String[] args) {
          ArrayFill arrayFill = new ArrayFill();
          arrayFill.makeArray();
          for(int value: arrayFill.makeArray()){
              System.out.println(value);
          }
      }
  }
  </code></pre>
  <hr />
  <pre class="lang-java prettyprint-override"><code>public class ArrayFill {
  
      public int[] makeArray(){
          int[] array = {
              6, 13, 34, -10, 15
          };
          return array;
      }
  
      public int[] changeArray(int[] array){
          array[1] = 6;
          array[3] = array[3] + 2;
          int[] arrayCopy = new int[array.length];
          for (int value: array) {
              array[value] = arrayCopy[value];
          }
          return arrayCopy;
      }
  }
  </code></pre>