Java の次のコードの違いは何ですか? オブジェクトが Java でどのように渡されるかを明確に把握できませんでした。誰でも以下のコードを説明できますか。
package cc;
public class C {
    public static class Value {
        private String value;
        public void setValue(String str) {
            value=str;
        }
        public String getValue() {
            return value;
        }
    }
    public static void test(Value str) {
        str.setValue("test");
    }
    public static void test2(Value str) {
        str=new Value();
        str.setValue("test2");
    }
    public static void main(String[] args) {
        String m="main";
        Value v=new Value();
        v.setValue(m);
        System.out.println(v.getValue()); // prints main fine
        test(v);
        System.out.println(v.getValue()); // prints 'test' fine
        test2(v);
        System.out.println(v.getValue()); // prints 'test' again after assigning to test2 in function why?
    }
}