Java Stack create from Deque

Description

Java Stack create from Deque

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());
    }//w w w  .j ava  2 s  .  com

  }
}



PreviousNext

Related