Interview questions
Question 239 of 253
FreeWhat is object cloning and the Cloneable interface in Java?
Misc / Best Practices
Cloning creates a copy of an object via Object.clone(). Cloneable is a marker interface with no methods — a class must implement it, or clone() throws CloneNotSupportedException. The default clone() is a shallow copy; classes needing a deep copy must override clone() to explicitly duplicate mutable referenced fields too.
Intermediate5 min

