CITS2200
Interface Stack


public interface Stack

Stack interface.


Method Summary
 Object examine()
          examine the item on the top of the stack
 boolean isEmpty()
          test whether the stack is empty
 Object pop()
          remove the item at the top of the stack
 void push(Object a)
          insert an item on the top of the stack
 

Method Detail

isEmpty

boolean isEmpty()
test whether the stack is empty

Returns:
true if the stack is empty, false otherwise

push

void push(Object a)
          throws Overflow
insert an item on the top of the stack

Parameters:
a - the item to insert
Throws:
Overflow

examine

Object examine()
               throws Underflow
examine the item on the top of the stack

Returns:
the top item
Throws:
Underflow - if the stack is empty

pop

Object pop()
           throws Underflow
remove the item at the top of the stack

Returns:
the removed item
Throws:
Underflow - if the stack is empty