StackDemo.java.html

  1  public class StackDemo
  2  {
  3     public static void main(String[] args)
  4     {
  5        Stack<Integer> countdown = new Stack<Integer>();
  6        for (int i = 0; i <= 10; i++)
  7        {
  8           countdown.push(i);
  9        }
 10  
 11        while(countdown.size() > 0)
 12        {
 13           System.out.println(countdown.pop());
 14        }      	
 15     }
 16  }