Question: Given Deque<? super Writer> queue = new LinkedList<Writer>(), what are the following code compiles?
Choice:
A. queue.add(new Writer());
B. queue.add(new BufferedWriter());
C. queue.add(new FileReader());
D. queue.add(new BufferedInputStream());
E. queue.add(new FileWriter());
F. queue.add(new PrintStream());
G. queue.add(new OutputStreamWriter());
H. queue.add(new printWriter());
Explain: regardless of the right side assignment, only the left side type declaration counts: Deque<? super Writer> queue You can only add the subclass of Writer to the queue. Of course you need to be familiar with NIO classes. We didn't choose A because Writer is an abstract class.