It's a marker interface to let Java know that implementing class is intentionally being designed for cloning(similar use as of other marker interfaces). If you read further, then you find below:
By convention, classes that implement this interface should override Object.clone (which is protected) with a public method. See Object.clone() for details on overriding this method.
You need to provide custom method for cloning. By having the interface Cloneable
, Java is aware that you are intentionally supporting cloning of your object. By providing your custom clone
method, you are over-ridding the default clone
method of the object.
This way, you get the flexibility to decide(Mark), which objects can be cloned and which not. If clone-able then up to what level(very useful in object graph cases).