This is a shallow copy because it only copies links to other objects. Let's say we have these classes:
class A { B variable A() { variable = new B(); } } class B { }
And now we create a clone of instance A:
A firstA = new A(); A secondA = firstA.clone();
Instance B in firstA and secondA will be the same. You will not have a copy of instance B. That's why clone () is called a shallow copy.
The diagrams on the linked page should help you understand all this.
krtek
source share