Only fields with primitive data types are transferred in a shallow copy; references to objects are not copied. Deep copy involves both the copying of object references and primitive data types. When to use shallow copy and when to use deep copy has no set, unbending rules.
In shallow copy, only fields of primitive data type are copied while the objects references are not copied. Deep copy involves the copy of primitive data type as well as object references. There is no hard and fast rule as to when to do shallow copy and when to do a deep copy.