Originally posted by ak pillai:
Cloning does a shallow cloning.
For example, if you clone a HasMap only the Map will be cloned and objects stored in the HashMap will still be pointing to the same object.
Map's clone is defined in that way because, given a shallow copying method, you can always build on it to define a "deep copy", whilst defining a shallow copy using a deep copy method is much harder
When overriding clone on your own classes, you are free to define it to do a deep copy.