reference type in Java
<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><br>
  <a href="http://stackoverflow.com/questions/9404625/java-pass-by-reference">Java pass by reference</a>  </p>
</blockquote>



<p>For the following Java program, my understanding is that <code>a</code> is a reference type to an Integer, like pointer type in C/C++. So any changes done in method <code>f</code> to its value will be reflected after the method returns. But <code>println</code> still prints its original value <code>0</code> instead of 3. </p>

<p><code>Integer</code> and <code>int</code> does not make a difference. Was my previous understanding wrong? Please help. Thank you!</p>

<pre><code>  public static void f(Integer b){
            b=3;
        }
        public static void main(String[] args){
            Integer a=0;
            f(a);
            System.out.println(a);
      }
</code></pre>
