An Example of an Immutable Class - Java Object Oriented Design

Java examples for Object Oriented Design:Class

Description

An Example of an Immutable Class

Demo Code

public class IntWrapper {    
  private final int value;

  public IntWrapper(int value) {
    this.value = value;
  }//  w  ww  .  j a  v a2  s  .c o  m

  public int getValue() {
    return value;
  }
}

Related Tutorials