Java Deque create from ArrayDeque
import java.util.ArrayDeque; import java.util.Deque; public class Main { public static void main(String args[]) { Deque<String> stack = new ArrayDeque<String>(); stack.push("CSS"); stack.push("HTML"); stack.push("Java"); stack.push("Javascript"); while (!stack.isEmpty()) { System.out.println(stack.pop()); }//from w w w.j ava 2 s .c om } }