public class StackArray{ final int max = 1000; private char items[] ; private int top; public StackArray() { items = new char[max]; top = -1; } public boolean isEmpty() { return top<0; } public boolean isFull() { return top == max-1; } public void push(char newItem) { if( !isFull() ) { items[++top] = newItem; } } public void popAll() { items = new char[max]; top = -1; } public char pop() { if(!isEmpty() ) { return items[top--]; } return '#'; } public char peek() { if( !isEmpty() ) { return items[top]; } return '#'; } }