title: Is passing object to constructor pass by reference
body: <p>Suppose I have a class and constructor called <code>TestClass</code>.</p>
  
  <pre><code>public class TestClass {
      Foo foo;
  
      public TestClass(Foo foo) {
          this.foo = foo; 
      }
  }
  </code></pre>
  
  <p>Here, the constructor accepts an object which is an instance of class <code>Foo</code>. Suppose my <code>static void main(String[] args)</code> does the following, completely separate from any <code>TestClass</code>;</p>
  
  <ul>
  <li><p>(1) Instantiate <code>foo</code></p></li>
  <li><p>(2) Pass instance <code>foo</code> to <code>TestClass</code> constructor</p></li>
  <li><p>(3) Change the internal state of <code>foo</code></p></li>
  </ul>
  
  <p>After step (3), will the <code>foo</code> <em>within</em> my instance of <code>TestClass</code> <em>also</em> have its state changed?</p>