要订正这个问题,可在dog中添加一个readresolve方法,它可以将那个隐藏的构造器转变为一个隐藏的静态工厂(static factory),以返回原来那个的dog [ej items,57]。
基于52个网页-相关网页
使用静态工厂方法创建一个msg对象。
唯一的特别之处在于几个方便操纵字段的静态工厂方法。
The only special part is several convenient static factory methods for manufacturing fields.
第一个类使用构造函数初始化属性,第二个类使用静态工厂方法。
The first class USES a constructor to initialize the properties, and the second class USES a static factory method.
应用推荐