创建对象状态后可以更改其对象的可变类的示例
public class IntHolder { private int value;/*nowjava.com - 时 代 Java 提供*/ public IntHolder(int value) { this.value = value; } public void setValue(int value) { this.value = value; } public int getValue() { return value; } }
public class IntHolder { private int value;/*nowjava.com - 时 代 Java 提供*/ public IntHolder(int value) { this.value = value; } public void setValue(int value) { this.value = value; } public int getValue() { return value; } }