如何编写类中的setter和getter

💡 原文中文,约2000字,阅读约需5分钟。
📝

内容提要

在effective java中有一item叫”保护性拷贝”,今天又看了许多部门里的代码,发现很多代码都与该item“相违”,晚上和toidi\_xu讨论这个问题有些收获。 Considering the following code: public class Box {         private int length;     public void setLength(int leng...

➡️

继续阅读