public class Practice {
    public int value;
    public Practice child;
    public Practice(int value) {
        this.value = value; 
    }
    public static void main(String[] args) {
        Practice obj = new Practice(10);
        Practice obj2 = new Practice(9);
        Practice obj3 = new Practice(11);
        obj.child = obj3;
        obj.child = obj2;
        System.out.println(obj2 == obj3);
    }
}
In this code, since I made obj.child = obj3, then I thought you could substitute obj3 for obj.child so that in other words the line "obj.child = obj2" could mean "obj3 = obj2". However, in the print statement it returns false.
However, if you do something like
obj.child = obj3;
obj.child.value = obj2.value;
Then you are actually manipulating obj3 as its value changes, however in the previous code obj3 is only "replaced" however the object remains unchanged.
Same thing here:
obj.child = obj3;
obj2 = obj.child;
Now they are actual equal... so you can subsitute obj3 for obj.child? Now Im confused... Bit of a novice coder so I would appreciate if someone would clear this up for me. Thank you!!
 
    