Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.LinkedBlockingDeque; public class LinkedBlockingDequeOfferLastExample2 { static int i=1; public static void main(String[] args) { int capacity=100; LinkedBlockingDeque
deque = new LinkedBlockingDeque
(capacity); deque.add("Kapil"); deque.add("Payal"); deque.add("Diksha"); deque.add("Nishank"); for (String xyz : deque){ System.out.println(i++ +". "+xyz); }int i=1; System.out.println("After adding string at last position :"); deque.offerLast("Manav"); for (String xyz : deque){ System.out.println(i++ +". "+xyz); } } }
Output