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