public void push(int item) { NodeN t = new NodeN(item); t.next = top; top = t; }
public int pop() { if (top != null) { int item = top.data; top = top.next; return(item); } return(0); }
void appendToTail(int d) { NodeN end = new NodeN(d); NodeN n = this; while (n.next != null) { n = n.next; } n.next = end; }