Question: what is the difference between shallow and deep cloning in java?
Answer: 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 objet references.