如果我有这样一个类:
public class MyObject { private int myField = 2; public void setMyField(int f) { this.myField = f; } }
这个类的对象是否可变?
谢谢!
解决方法
是
Mutable objects have fields that can be changed,immutable objects have no fields that can be changed after the object is created.