/** * Class: StackDemo * Author: Peter Williams * LastEdit: Thu Mar 21 15:13:27 2002 * Purpose: To demonstrate the use of a simple stack */ import DataStructures.*; public class StackDemo { public static void main(String[] args) { Stack s = new StackArray(); // Stack s = new StackList(); for (int i = 0; i < 8; i++) { s.push(new Integer(i)); } while (!s.isEmpty ()) { System.out.println(s.pop()); } } }