Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.ConcurrentLinkedQueue; public class ConcurrentLinkedQueueOfferExample2 { public static void main(String[] args) throws InterruptedException { ConcurrentLinkedQueue
queue = new ConcurrentLinkedQueue
(); queue.add("Reema"); queue.add("Rahul"); queue.add("Rita"); queue.add("Ramesh"); //offer() method insert the element at the tail of queue queue.offer("Gita"); for(String xyz:queue){ System.out.println(xyz); } } }
Output