the Cloneable Interface
Besides overriding the clone() method in java.lang.Object, a class may implement the interface Cloneable to indicate that it makes sense to clone this type of object.
The interface is an empty one.
You don't need to supply any methods to conform to Cloneable, although you may want to override the default clone() method.
Other classes can tell whether a class implements Cloneable by examining its class descriptor (an instance of the class Class).
No comments:
Post a Comment