change the reference passed to function in java
<p>I know that we cannot change the reference passed to a function such as</p>

<pre><code>void fun(dog a){
 a=null;
}
</code></pre>

<p>After executing the function</p>

<pre><code>main(String[] args){

 dog a=new dog();
 fun(a);
}
</code></pre>

<p>the dog a is not changed.
So I was wondering how can we change the reference a to null inside a function</p>
