Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.LinkedTransferQueue; public class LinkedTransferQueueAddExample1 { public static void main(String[] args) { int j =1; LinkedTransferQueue
queue = new LinkedTransferQueue
(); for (int i = 1; i <=5; i++) { // Adding items to the tail of this queue queue.add(i); System.out.println("After adding "+ j++ +" to the queue :"); System.out.println(queue); } } }
Output