public class TestStack2 { public static void main (String args []) { Stack myStack; // Integer topValue; Object topValue; myStack = new Stack(); myStack.push(4); myStack.push(42); myStack.push(675); myStack.push(1000); myStack.push(Math.PI); myStack.push("Ha ha smarty pants "); myStack.push (-87); myStack.push (true); for (int i = 0; i < 7; i++) { topValue = myStack.pop(); // topValue = (Object) myStack.pop(); // this works too System.out.println (topValue); } // end for } // end main } // end class