Complete the code to add an element to the end of the queue.
queue.[1](element);push which is for stacks.enqueue which is not a Java Queue method.In Java's Queue interface, add() adds an element to the end of the queue.
Complete the code to remove the element at the front of the queue.
queue.[1]();pop which is for stacks.remove which throws exception if queue is empty.The poll() method removes and returns the head of the queue or returns null if empty.
Fix the error in the code to check the front element without removing it.
Element front = queue.[1]();get which does not exist for Queue.top which is for stacks.The peek() method returns the head of the queue without removing it, or null if empty.
Fill both blanks to create a queue and add an element to it.
Queue<String> queue = new [1]<>(); queue.[2]("apple");
ArrayList which does not implement Queue.offer which is an alternative to add but not the answer here.Use LinkedList to create a queue and add() to add elements.
Fill all three blanks to remove and print all elements from the queue until it is empty.
while (!queue.[1]()) { String item = queue.[2](); System.out.[3](item); }
remove() which throws exception if empty.print instead of println.Use isEmpty() to check if queue is empty, poll() to remove elements safely, and println() to print.
