Stack Example


There are several files to look at to understand this example. All but the StackTest.java file are part of a package StackDataStructures, and should be palced in a subdirectory with that same name.

The StackAr class (array implementation of stacks) is defined in StackAr.java.

The exceptions (poorly done) are in Underflow.java and Overflow.java.
 

The driver, which inputs a string and checks it for balanced parentheses, is in StackTest.java.