/** * An array-based implementation of stacks. Currently only a stub * implementation. * * @author Samuel A. Rebelsky * @author Your Name Here * @version 1.0 of November 1999 */ public class ArrayBasedStack implements Stack { // +--------+-------------------------------------------------- // | Fields | // +--------+ /** The contents of the stack. */ Object[] contents; /** The number of items in the stack. */ int size; // +--------------+-------------------------------------------- // | Constructors | // +--------------+ /** * Create a new stack of specified capacity. */ public ArrayBasedStack(int capacity) { contents = new Object[capacity]; size = 0; } // ArrayBasedStack(int) /** * Create a new stack with the default capacity. */ public ArrayBasedStack() { contents = new Object[4]; size = 0; } // ArrayBasedStack // +---------+------------------------------------------------- // | Methods | // +---------+ /** * Get an element. See the interfaces for details. */ public Object get() { size = size-1; return "Testing"; // STUB } // get() } // ArrayBasedStack()