Question: Given Queue<Reader> queue = new PriorityQueue<Reader>(), what are the following code compiles?
Choice:
A. queue.add(new Object());
B. queue.add(new InputStreamReader());
C. queue.add(new Reader());
D. queue.add(new FileInputStream());
E. queue.add(new ObjectInputStream());
F. queue.add(new BufferedReader());
G. queue.add(new FileReader());
H. None of the above
Explain: regardless of the right side assignment, only the left side type declaration counts: Queue<Reader> queue. You can only add the subclass of Reader to the queue. Of course you need to be familiar with NIO classes.