title: Changing the values of variables in methods, Java
body: <p>I have a question about changing the values of variables in methods in Java.</p>
  
  <p>This is my code:</p>
  
  <pre><code>public class Test {
      public static void funk(int a, int[] b) { 
          b[0] = b[0] * 2; 
          a = b[0] + 5;
      } 
  
      public static void main(String[] args) {
          int bird = 10;
          int[] tiger = {7};
  
          Test.funk(bird, tiger);
      }
  }
  </code></pre>
  
  <p>After the execution of the method <code>Test.funk(bird, tiger)</code>, the value of bird is not changed - it remains with the value <code>10</code>, even though in the <code>funk()</code> method we have changed the value with <code>a = b[0] + 5;</code></p>
  
  <p>On the other hand, the value of the element in the array changes, because we have the statement <code>b[0] = b[0] * 2;</code></p>
  
  <p>I don't understand why one thing changes and the other not? Could someone please explain this for me.</p>