title: Linking object references in java
body: <p>So I'm doing this project in java where an objects a has an array, a. Then, you take a part of the array and assign it to another object, s, such that changing values in s changes them in a. I'm banging my head over this, I'm just not <em>getting</em> it. There is some concept that I'm missing. </p>
  
  <pre><code>public class IntArray implements IntSequence {
  
  int[] a;
  
  public IntArray(int size) {
      a = new int[size];
  }
  
  public int length() {
  }
  
  public int get(int index) {
      return a[index];
  }
  
  public void set(int index, int value) {
      a[index] = value;
  }
  
  public IntSequence subSequence(int index, int size) {
  }
  
  public static void main(String[] args) {
      IntSequence a = new IntArray(5);
      a.set(0, 11);
      a.set(1, 22);
      a.set(3, 33);
      // some more values
  
      IntSequence s = a.subSequence(2, 2);
      s.set(0, 100);
      s.set(1, 200);
  
      System.out.println(a.get(2)); // prints 100. 
  
      }
  }
  
  
  public interface IntSequence {
  int length();
  
  int get(int index);
  
  void set(int index, int value);
  
  IntSequence subSequence(int index, int size);
  }
  </code></pre>
  
  <p>Could someone give me a nudge in the right direction? Thank you.</p>