??????δ????????????????????????

??????????????????????Vector??????ArrayList????????
????????????е?????????????????????
????????????Vector?е?add??????get????????????????????????ж???????з?????????????????????ж??????????????????????????????ж?????????????????????Щ????????????????
???????????????????????????????Java 1.5???????????????λ??java.util.concurrent???£?????????????????????????????н?????
????2.??????????????????
??????????????Vector?е??????????????????????????????????????????????????????????δ???
public class Test {
static Vector<Integer> vector = new Vector<Integer>();
public static void main(String[] args) throws InterruptedException {
while(true) {
for(int i=0;i<10;i++)
vector.add(i);
Thread thread1 = new Thread(){
public void run() {
for(int i=0;i<vector.size();i++)
vector.remove(i);
};
};
Thread thread2 = new Thread(){
public void run() {
for(int i=0;i<vector.size();i++)
vector.get(i);
};
};
thread1.start();
thread2.start();
while(Thread.activeCount()>10)   {
}
}
}
}
????????????????е?????

?????????????????????δ?????????????±???硣
?????????????????Vector????????????????????????????????Vector??????????????????????????????????????????????????
?????????????????????????????
????for(int i=0;i<vector.size();i++)
????vector.get(i);
??????????vector??size???????????10??i????9
?????????????????????????
????for(int i=0;i<vector.size();i++)
????vector.remove(i);
???????±??9???????????
??????????get?????????±??9?????????????????
???????????????????????????????????????????????????????????
public class Test {
static Vector<Integer> vector = new Vector<Integer>();
public static void main(String[] args) throws InterruptedException {
while(true) {
for(int i=0;i<10;i++)
vector.add(i);
Thread thread1 = new Thread(){
public void run() {
synchronized (Test.class) {   //???ж???????
for(int i=0;i<vector.size();i++)
vector.remove(i);
}
};
};
Thread thread2 = new Thread(){
public void run() {
synchronized (Test.class) {
for(int i=0;i<vector.size();i++)
vector.get(i);
}
};
};
thread1.start();
thread2.start();
while(Thread.activeCount()>10)   {
}
}
}
}
????3. ConcurrentModificationException??
???????Vector??????????????е???????????ConcurrentModificationException???????????????????????????н?????
??????????????????в?????????????