public class MyStack { protected Object[] items; protected int n; public MyStack() { items = new Object[1000]; n = 0; } public void push(Object item) { items[n++] = item; } public Object pop() { return items[--n]; } public boolean empty() { return n == 0; } }