when will a function change the param?
import java.util.*;
publicclass test
{publicvoid setDate(Date d)throws Exception
{
Thread.sleep(1000);
d=new Date();}
publicvoid add(HashSet h)
{
h.add("1"+Math.random());
}
publicstaticvoid main(String[] args)throws Exception
{
test t=new test();
Date d=new Date();
HashSet h=new HashSet();
System.out.println(d.getTime());
System.out.println(h.size());
t.setDate(d);
t.add(h);
System.out.println(d.getTime());
System.out.println(h.size());
}
}
=================
result:
1127460274718
0
1127460274718
1
=============
the first function,with a Date param after execute, the param doesn't change.
the second function,with a HashSet param, after execute the param has changed,
is it means the function only can modify the param's inner element,
but can not new one element to param.

