I think, this is because of the "shallow copying" technique while cloning.
This is what
Java docs say regarding Object#clone() method:
The method clone for class Object performs a specific cloning operation. First, if the class of this object does not implement the interface Cloneable, then a CloneNotSupportedException is thrown. Note that all arrays are considered to implement the interface Cloneable. Otherwise, this method creates a new instance of the class of this object and initializes all its fields with exactly the contents of the corresponding fields of this object, as if by assignment; the contents of the fields are not themselves cloned. Thus, this method performs a "shallow copy" of this object, not a "deep copy" operation.
So, when you clone 2D array, all the internal primitive variables copy dosen't get created, but only upper layer 2 single dimension array is get copied.
i.e, This code will work and won't change the 'data'