public class intStackList extends intStack { static class Node { int val; Node next; Node (int v, Node t) { val= v; next= t; } } private Node head; intStackList (int n) { head = new Node (0, null); } public boolean empty () { return head.next == null; } public void push (int i) { Node t = new Node (i, head.next); head.next = t; } public int pop () { int i = head.next.val; head.next = head.next.next; return i; } }