package devmanuals.com; import java.util.Queue; import java.util.LinkedList; public class QueueAddElement { public static void main(String[] args) { Queue q = new LinkedList(); System.out.println("Initially the size of queue is " + q.size()); System.out.println("Elements in queue : "+q); q.add(1); q.add(2); System.out .println("After addition of elements into queue, the elements are :"+q); System.out.println("And the size of queue : " + q.size()); System.out.println("Now insert a new element '4'"); q.add(4); System.out.println("Then the new Elements of queue are : " + q); System.out.println("And the size of new queue = " + q.size()); } }