I asked a question about cloning in java and got answers saying deep copy creates a new instance of the object carrying the same state and data in the member variables. I was told shallow copying is just assigning an object reference to another reference variable. But that's NOT copying that's assignment (making a new pointer for the object location).
What is deep copying of objects then really if there are reference variables contained within the object you are trying to clone? Would using myObj2 = myObj.clone() clone all components within the object? Lets say if myObj contained other reference variables pointing to other object locations, would those reference variables also be cloned? So myObj2's internal reference variables would not be pointing to the same old object locations that pointers in myObj where pointing to.. I need clarity here to fully understand what cloning is all about.
Thank you in advance.