title: Java pass by reference
body: <p>What is the difference between this 2 codes:</p>
  
  <p>Code A:</p>
  
  <pre><code>Foo myFoo;
  myFoo = createfoo();
  </code></pre>
  
  <p>where</p>
  
  <pre><code>public Foo createFoo()
  {
     Foo foo = new Foo();
     return foo;
  }
  </code></pre>
  
  <p>Vs. Code B:</p>
  
  <pre><code>Foo myFoo;
  createFoo(myFoo);
  
  public void createFoo(Foo foo)
  {
     Foo f = new Foo();
     foo = f;
  }
  </code></pre>
  
  <p>Are there any differences between these 2 pieces of codes?</p>