public class Stack{
private Object[] objects;
private int size = 0;
private static final int DEFAULT_INITIAL_CAPACITY = 16;
public Stack() {
objects = new Object[DEFAULT_INITIAL_CAPACITY];
}
public void push(Object e) {
objects[size++] = e;
}
public Object pop() {
if (size == 0) {
throw new EmptyStackException();
}
return objects[--size];
}
}
---请留言。。