An Example of a Mutable Class Whose Object's State Can Be Changed After Creation - Java Object Oriented Design

Java examples for Object Oriented Design:Class

Description

An Example of a Mutable Class Whose Object's State Can Be Changed After Creation

Demo Code

public class IntHolder {
  private int value;
    //from   w  w w .  j  a v a  2s .c  o m
  public IntHolder(int value) {
    this.value = value;
  }

  public void setValue(int value) {
    this.value = value;  
  }

  public int getValue() {
    return value;
  }
}

Related Tutorials