title: Variable scope with a method in Java
body: <p>I thought I understood variable scope until I came across this bit of code:</p>
  
  <pre><code>private static void someMethod(int i, Account a) {
    i++;
    a.deposit(5);
    a = new Account(80);
  }
  
  int score = 10;
  Account account = new Account(100);
  someMethod(score, account);
  System.out.println(score); // prints 10
  System.out.println(account.balance); // prints 105!!!
  </code></pre>
  
  <p>EDIT: I understand why a=new Account(80) would not do anything but I'm confused about a.deposit(5) actually working since a is just a copy of the original Account being passed in...</p>