in general(not being language specific), if you want dynamic stack implementation, Linked List-based implementation provides a good and efficient stack implementation. If you don't want a dynamic implementation, using arrays would also be a very good implementation. In java Deque gives a great performance. OR if you want and alternative, you can also try this example which uses inbuilt Stack :
static void showpush(Stack st, int a) {
st.push(new Integer(a));
//add appropriate print statements
}
static void showpop(Stack st) {
Integer a = (Integer) st.pop();
//add appropriate print statements
}
public static void main(String args[]) {
Stack st = new Stack();
showpush(st, 42);
showpush(st, 66);
showpush(st, 99);
showpop(st);
showpop(st);
showpop(st);
}