Online Java Compiler By
JavaTpoint.com
import java.util.ArrayDeque; import java.util.Deque; public class JavaDequeremoveExample2 { public static void main(String[] args) { Deque
deque = new ArrayDeque<>(); deque.add("Computer"); deque.add("Programming"); deque.add("Language"); String val = deque.pop(); System.out.println("The first string that has been popped is : "+val); System.out.println("The remaining deque is given as : "); for (String string : deque) { System.out.println(string); } } }
Output