![]() ![]() ![]() Therefore, it is not possible to clone an object merely by virtue of the fact that it implements this interface. Note that this interface does not contain the clone method. See Object.clone() for details on overriding this method. ![]() ![]() Invoking Object’s clone method on an instance that does not implement the Cloneable interface results in the exception CloneNotSupportedException being thrown.īy convention, classes that implement this interface should override Object.clone (which is protected) with a public method. I faced this exception in my previously explained post: Ī class implements the Cloneable interface to indicate to the Object.clone() method that it is legal for that method to make a field-for-field copy of instances of that class.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |