Online Java Compiler By
JavaTpoint.com
import java.util.ArrayDeque; import java.util.Deque; public class JavaDequeremoveExample1 { public static void main(String[] args) { Deque
deque = new ArrayDeque<>(); deque.add('W'); deque.add('E'); deque.add('L'); deque.add('C'); deque.add('O'); deque.add('M'); deque.add('E'); Character val = deque.pop(); System.out.println("The first character which has been popped is : "+val); System.out.println("The remaining deque is given as :"); for (Character character : deque) { System.out.println(character); } } }
Output