package devmanuals.com; import java.util.*; public class QueueElementMethodExample { public static void main(String[] args) { Queue queue = new LinkedList(); queue.offer("11"); queue.offer("22"); queue.offer("33"); queue.offer("44"); System.out.println("The size of the queue : " + queue.size()); System.out.println("Queue head using peek : " + queue.peek()); System.out.println("Queue head using element : " + queue.element()); System.out.println("The element of queue are : " + queue); Object element; while ((element = queue.poll()) != null) { System.out.println("The " + element + " is removed"); } System.out.println("The Queue after removal : " + element); } }