class IntStack { private Cell llist; public IntStack() { llist = null; } public int top() { return llist.first; } public void pop() { llist = llist.next; } public void push(int n) { llist = new Cell(n,llist); } public boolean isEmpty() { return llist==null; } private static class Cell { int first; Cell next; Cell(int f,Cell n) { first=f; next=n; } } }