Clonable接口
第一次见到还是Clonable接口,为什么会没有方法?
那实现了有什么用?
可以看注释的这一句话
* A class implements the <code>Cloneable</code> interface to
* indicate(表明) to the {@link java.lang.Object#clone()} method that it
* is legal for that method to make a
* field-for-field copy of instances of that class.
实现了Cloneable接口的类,表明它可以合法的使用域之间的复制。
其实也就是实现了Cloneable接口,才有能力使用Clone()方法,而Object类里面本身就有声明Clone()方法,所以Clonable接口就不用再声明了。
这就是所谓的标记接口: