title: Changing array in method changes array outside
body: <p>I have trouble with scope of variable.</p>
  
  <pre><code>public static void main(String[] args){
      int[] test={1,2,3};
      test(test);
      System.out.println(test[0]+" "+test[1]+" "+test[2]);
  }
  
  static void test(int[] test){
      test[0]=5;
  }
  </code></pre>
  
  <p>I expected the output to <code>1 2 3</code>, but the result was <code>5 2 3</code>.
  Why I changed the value in the array in the method, but the original array changed?</p>