Sunday, May 29, 2011

Restrictions on clone method

There are couple of restrictions on clone methods:
  • It is a protected method and can only be called from within the same class or the module that contains the class.
  • We can only clone objects which are declared to implement the Cloneable interface.
  • Objects that cannot be cloned throw the CloneNotSupportedException.

No comments:

Post a Comment

Chitika