Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which one of the following statements about what the Cloneable interface declares is true?

  • A.Nothing; it is a marker.
  • B.It declares clone().
  • C.It declares clone() and equals().
  • D.It declares deepClone().

Answer: A

Cloneable has no methods at all. It exists only so that Object.clone can check for it: a class that does not implement it gets CloneNotSupportedException instead of a copy. That makes it an unusual interface, since implementing it changes the behaviour of an inherited method rather than adding one.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.