java queue remove
import java.util.*;
public class QueueDemo {
public static void main(String[] args)
throws IllegalStateException
{
// create object of Queue
Queue<Integer> queue
= new LinkedList<Integer>();
// Add numbers to end of Queue
queue.add(1);
queue.add(2);
queue.add(3);
queue.add(4);
// print queue
System.out.println("Queue: " + queue);
// print head and deletes the head
System.out.println("Queue's head: " + queue.remove());
// print head and deleted the head
System.out.println("Queue's head: " + queue.remove());
}
}