提供一段示例代码
import javautilArrayList;
/**
*
* @author WeiLiu
*/
public class Main {
public interface var{
public static ArrayList all=new ArrayList();
}
static class Thread extends Thread implements var{
private int id;
public Thread(int tempid){
thisid = tempid;
}
@Override
public void run() {
int count=;
while(count<){
alladd(thisid);
count++;
Systemoutprintln(allsize());
}
}
}
public static void main(String[] args) {
Thread temp = new Thread();
Thread temp = new Thread();
tempstart();
tempstart();
}
}