import java.util.*; public class StackExample { public static void main (String[] argv) { // The Java library has a Stack data structure. Here, we'll // make a stack to hold strings. Stack toDoList = new Stack (); // Add some strings. toDoList.push ("Pay bills"); toDoList.push ("Clean room"); toDoList.push ("Do homework"); toDoList.push ("See movie"); toDoList.push ("Hang out"); // Print. System.out.println ("Priorities: "); while (! toDoList.isEmpty() ) { String nextPriority = toDoList.pop (); System.out.println (" " + nextPriority); } } }