Given:
import java.util.ArrayDeque;
import java.util.Deque;
public class Counter {
public static void main(String[] args) {
Deque<String> deq = new ArrayDeque<String>(2);
deq.addFirst(“one”);
deq.addFirst(“two”);
deq.addFirst(“three”); // Line 9
System.out.print(deq.pollLast());
System.out.print(deq.pollLast());
System.out.print(deq.pollLast()); // Line 12
}
}
What is the result?
A.
An exception is thrown at runtime on line 9.
B.
An exception is thrown at runtime on line 12
C.
one two null
D.
one two three
E.
two one null
F.
three two one
D, but without spaces
D
D
Output : onetwothree