public class StackOfIntergers {
private int[] elements;//栈中的元素都储存在一个名为elements的数组中,创建栈的时候,同时也创建了这个数组
private int size;//size记录了栈中元素的个数
public StackOfIntergers() {
//构建一个默认容量为16的空栈
elements = new int[16];
}
public StackOfIntergers(int capacity) {
//构建一个指定容量的空栈
elements = new int[capacity];
}
public boolean empty() {