title: Error removing an item from an ArrayList
body: <p>I'm trying to remove a value from the list using thread. But the code fails and gives an exception. Plz help I'm a beginner in thread programming.....</p>
  
  <p>This is the content of <code>Test.java</code></p>
  
  <pre><code>import java.util.*;
  
  public class Test {
      private static final List&lt;Integer&gt; Values = new ArrayList&lt;Integer&gt; ();
      public static void main(String args[]) {
          TestThread t1 = new TestThread(Values);
          t1.start();
  
          System.out.println(Values.size());
      }
  }
  </code></pre>
  
  <p>This is the content of <code>TestThread.java</code></p>
  
  <pre><code>import java.util.*;
  
  public class TestThread extends Thread {
      private final List&lt;Integer&gt; Values;
  
      public TestThread(List&lt;Integer&gt; v) {
          this.Values = v;
          Values.add(5);
      }
  
      public void run() {
          Values.remove(5);
          System.out.println("5 removed");
      }
  }
  </code></pre>