Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.LinkedTransferQueue; public class LinkedTransferQueueOfferExample2 { public static void main(String[] args) throws InterruptedException { LinkedTransferQueue
queue = new LinkedTransferQueue
(); queue.add("John"); queue.add("Harry"); queue.add("Kristan"); queue.add("Jack"); //offer() method insert the element at the tail of queue queue.offer("Marry"); for(String xyz:queue){ System.out.println(xyz); } } }
Output