ExecutorService pool = Executors.newSingleThreadExecutor();
pool.execute(new Runnable() {
@Override
public void run() {
for (int i = 0; i < 1000; i++) {
try {
Thread.sleep((new Random().nextInt(10)+1)*1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
vecirles.add(Road.this.name+"_"+i);
}
}
});
vecirles.add(Road.this.name+"_"+i)----这样的访问方式是可以的,这个表示的是什么意思呢? 不是把name编程final了就可以了吗...?
|