Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Java API for the clone() method [API 2011] says:

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

...

Failing to call super.clone() may result in a cloned object having the wrong type, with resulting unexpected or incorrect results when it is used.

Bibliography

 

...