package examples.stack2;
/**
* Author: W. M. Farmer
* Revised: February 21, 2007
*
* Description: Exception that results when top or pop is applied
* to an empty stack.
*
* @author W. M. Farmer
*/
public class EmptyStackException extends Exception {
private Stack stack_;
/**
* Constructs the EmptyStackException.
*
* @param s the Stack that raised the exception
*/
public EmptyStackException(Stack s) {
stack_ = s;
}
/**
* Creates a String description of the exception.
*
* @return a String
*/
public String toString() {
return "examples.stack2.EmptyStackException: The stack " +
stack_.toString() + " is empty.";
}
}