package genericstack_mardigras; /** * * @author levenick Feb 24, 2017 2:17:59 PM */ public class Stack { Object[] list; int last; // Index of the tail... and in this case, the top of the stack private final int MAX=1000; // if you want to store more than 1000 things, this should change! Stack() { last = -1; list = new Object[MAX]; } void push(E insertMe) { last++; list[last] = insertMe; } E pop() { last--; return (E) list[last+1]; } boolean isEmpty() { return last == -1; } }