I read javadoc for Object
and Cloneable
and just don't βgetβ something. Can someone explain to me the performance and / or functional differences of the two following examples:
public class Widget { @Override public Widget clone() {
.. and:
public class Widget implements Cloneable { @Override public Widget clone() {
Since Cloneable
has no methods attached to it and gives you access to the Object
protected clone () method, does it make sense to ever implement it first, seeing that you will eventually have to write your own (safe) clone code () anyway? Thanks in advance for any clarification / input.
source share