import java.util.*; public class StackImpl2 implements OurStackInterface { // Use a linked list instead of an array. LinkedList list; public StackImpl2 () { // Can be unlimited in size now. list = new LinkedList(); } public void push (char ch) { // No need to check for upper limit. list.add (ch); } public char pop () { if (! list.isEmpty()) { return list.removeLast(); } else { System.out.println ("ERROR in OurStack.pop(): stack empty"); return '@'; } } public boolean isEmpty () { return list.isEmpty(); } }