import java.util.*; public class OurStack3 { // Use a linked list instead of an array. LinkedList list; public OurStack3 () { // 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(); } }