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.....
This is the content of Test.java
import java.util.*;
public class Test {
    private static final List<Integer> Values = new ArrayList<Integer> ();
    public static void main(String args[]) {
        TestThread t1 = new TestThread(Values);
        t1.start();
        System.out.println(Values.size());
    }
}
This is the content of TestThread.java
import java.util.*;
public class TestThread extends Thread {
    private final List<Integer> Values;
    public TestThread(List<Integer> v) {
        this.Values = v;
        Values.add(5);
    }
    public void run() {
        Values.remove(5);
        System.out.println("5 removed");
    }
}
 
     
    
 
     
     
    