title: Is Java really passing objects by value?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong>
    <a href="https://stackoverflow.com/questions/40480/is-java-pass-by-reference">Is Java pass by reference?</a></p>
  </blockquote>
  
  
  
  <pre><code>public class myClass{
      public static void main(String[] args){
          myObject obj = new myObject("myName");
          changeName(obj);
          System.out.print(obj.getName()); // This prints "anotherName"
      }
      public static void changeName(myObject obj){
          obj.setName("anotherName");
      }
  }
  </code></pre>
  
  <p>I know that Java pass by value, but why does it pass <code>obj</code> by reference in previous example and change it?</p>