import java.util.*; public class StackExample2 { public static void main (String[] argv) { Stack numberStack = new Stack (); // Push some numbers numberStack.push (1); numberStack.push (2); numberStack.push (3); // Print in reverse order by popping off the stack. while (! numberStack.isEmpty() ) { System.out.println (numberStack.pop()); } } }