What is the output of the following code? Queue q = new LinkedList (); q.add(10); q.add(4); System.out.println(q.size());
Question:
What is the output of the following code?
Queue q = new LinkedList<>();
q.add(10);
q.add(4);
System.out.println(q.size());
System.out.println(q.peek());
q.add(6);
System.out.println(q.remove());
q.add(3);
System.out.println(q.remove());
System.out.println(q.peek());
System.out.println(q.remove());
q.add(7);
System.out.println(q.peek());
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Question Posted: