我想在java中编写一个用于计算表达式的代码,比如括号是否已关闭以及括号等,但我必须使用堆栈来完成。我已经制作了Stack接口,StackEmptyException类和StackFullException类。
public interface Stack
{
public int size( );
// Returns the size of the Stack
public boolean isEmpty( );
// Returns true if the Stack is empty
public boolean isFull( );
// Returns true if the Stack is full
public Object top( ) throws StackEmptyException;
// Returns the top item of the Stack
public void push(Object item) throws StackFullException;
// Adds a new item into the Stack
public Object pop( ) throws StackEmptyException;
// Removes the top item of the Stack
}//End of interface Stack