public class App {
static BlockingQueue<String> queue = new LinkedBlockingQueue<String>(1);
public static void main(String[] args) throws Exception {
//ExecutorService executorService = Executors.newCachedThreadPool();
queue.add("1");//报错
queue.remove();//报错
queue.put("1");//阻塞
queue.take();//阻塞
queue.offer("1");//满了返回空
queue.poll(); //为空返回Null
}
}