Given the code fragment:
What is the result?
Given the code fragment:
What is the result?
C
C,tested
C is correct, but it would be printed in new lines. pop and remove both remove from start of queue and print what was removed and after tat queue is printed.
Answer is C: Deque<String> queue = new ArrayDeque<>(); queue.add("Susan"); queue.add("Allen"); queue.add("David"); System.out.println(queue.pop()); System.out.println(queue.remove()); System.out.println(queue);