Cloneable

Cloneable

java程序開發中的一個介面,Cloneable介面繼承了java.lang。

介面簡介


public interface Cloneable
如果一個類實現了 Cloneable 介面,以指示 Object.clone() 方法可以合法地對該類實例進行按欄位複製。
如果在沒有實現 Cloneable 介面的實例上調用 Object的 clone 方法,則會導致拋出 CloneNotSupportedException異常。
按照慣例,實現此介面的類應該使用公共方法重寫 Object.clone(它是受保護的)。請參閱 Object.clone(),以獲得有關重寫此方法的詳細信息。
注意,此介面不 包含 clone 方法。因此,因為某個對象實現了此介面就克隆它是不可能的。即使 clone 方法是反射性調用的,也無法保證它將獲得成功。

所有已知子介面


AclEntry, Attribute, AttributedCharacterIterator, Attributes, CertPathBuilderResult, CertPathParameters, CertPathValidatorResult, CertSelector, CertStoreParameters, CharacterIterator, CRLSelector, Descriptor, GSSCredential, Name