Untitled
public text v1 · immutablepublic class ArrayStack <E>{
public void push (E e){
if (size() == theStack.length)
grow ();
theStack [++ top]=e;
}
public E peek(){
return theStack[top];
}
public void pop (){
top --;
}
private E [] theStack;
private int top;
...
}