Question: Given Queue<InputStreamReader> queue = new PriorityQueue< InputStreamReader>(), 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<InputStreamReader> queue. You can only add the subclass of InputStreamReader to the queue. Of course you need to be familiar with NIO classes.