Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.LinkedBlockingDeque; public class LinkedBlockingDequeAddLastExample2 { static int i=1; public static void main(String[] args) { int capacity=100; LinkedBlockingDeque
deque = new LinkedBlockingDeque
(capacity); deque.add("Disha"); deque.add("Tanmay"); deque.add("Prachi"); deque.add("Garvit"); for (String xyz : deque){ System.out.println(i++ +". "+xyz); }int i=1; System.out.println("After adding string at last position :"); deque.addLast("Diya"); for (String xyz : deque){ System.out.println(i++ +". "+xyz); } } }
Output