请评估一下程序的执行结果?

摘要: 请评估一下程序的执行结果?

题目:请评估一下程序的执行结果?


public class SynchronousQueueQuiz {

    public static void main(String[] args) throws Exception {

        BlockingQueue<Integer> queue = new

        SynchronousQueue<>();

        System. out .print(queue.offer(1) + " ");

        System. out .print(queue.offer(2) + " ");

        System. out .print(queue.offer(3) + " ");

        System. out .print(queue.take() + " ");

        System. out .println(queue.size());

    }

}



A. true true true 1 3


B. true true true (阻塞)


C. false false false null 0


D. false false false (阻塞)


出题人:阿里巴巴出题专家:桃谷/阿里云中间件技术专家


参考答案:D


网友留言评论

0条评论