Java -- This seems like pass by reference to me
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/40480/is-java-pass-by-reference">Is Java pass by reference?</a>  </p>
</blockquote>



<p>So consider the following two examples and their respective output:</p>

<pre><code>public class LooksLikePassByValue {

    public static void main(String[] args) {

        Integer num = 1;
        change(num);
        System.out.println(num);
    }

    public static void change(Integer num)
    {
        num = 2;
    }
}
</code></pre>

<p>Output:</p>

<blockquote>
  <p>1</p>
</blockquote>

<hr>

<pre><code>  public class LooksLikePassByReference {

    public static void main(String[] args) {

        Properties properties = new Properties();
        properties.setProperty("url", "www.google.com");
        change(properties);
        System.out.println(properties.getProperty("url"));
    }

    public static void change(Properties properties2)
    {
        properties2.setProperty("url", "www.yahoo.com");
    }
}
</code></pre>

<p>Output:</p>

<blockquote>
  <p>www.yahoo.com</p>
</blockquote>

<p>Why would this be <code>www.yahoo.com?</code> This doesn't like like passbyvalue to me.</p>
