Effective Java: Analysis of the clone() method

前端 未结 5 661
南笙
南笙 2020-12-09 04:48

Consider the following from Effective Java Item 11 (Override clone judiciously) where Josh Bloch is explaining what is wrong with the clone() contract .

5条回答
  •  盖世英雄少女心
    2020-12-09 05:12

    See Jorado answer. This is the explanation. In additional clone has problem in final fields see : http://en.wikipedia.org/wiki/Clone_%28Java_method%29#clone.28.29_and_final_fields

    You also should read Josh interview on clone in: http://www.artima.com/intv/bloch13.html

提交回复
热议问题