Interface Cloneable
- All Known Subinterfaces:
Attribute
,AttributedCharacterIterator
,Attributes
,CertPathBuilderResult
,CertPathParameters
,CertPathValidatorResult
,CertSelector
,CertStoreParameters
,CharacterIterator
,CRLSelector
,Descriptor
,ExtendedGSSCredential
,GSSCredential
,Name
public interfaceCloneable
A class implements the
Cloneable
interface to indicate to theObject.clone()
method that it is legal for that method to make a field-for-field copy of instances of that class. Invoking Object's clone method on an instance that does not implement theCloneable
interface results in the exceptionCloneNotSupportedException
being thrown.
By convention, classes that implement this interface should overrideObject.clone
(which is protected) with a public method. SeeObject.clone()
for details on overriding this method.
Note that this interface doesnot contain theclone
method. Therefore, it is not possible to clone an object merely by virtue of the fact that it implements this interface. Even if the clone method is invoked reflectively, there is no guarantee that it will succeed.
- Since:
- 1.0
- See Also: