Online Java Compiler By
JavaTpoint.com
import java.util.ArrayDeque; import java.util.Deque; public class JavaDequepollExample2 { public static void main(String[] args) { Deque
deque = new ArrayDeque<>(); deque.offer("Java"); deque.offer("is"); deque.offer("a"); deque.offer("portable"); deque.offer("language"); String val = deque.poll(); System.out.println("The first string value is : "+val); System.out.println("The final deque is given as : "); for (String string : deque) { System.out.println(string); } } }
Output