- public class ArrayStack<E> {
- private E arrayOfStack[];
- private int top = -1;
- private int capacity = 10;
- public ArrayStack() {
- arrayOfStack = (E[]) new Object[capacity];
- }
- public int size()
- {
- return top +1;
- }
- public boolean isEmpty()
- {
- if(top==-1)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- }