/** * A stack provides last-in-first-out behavior. All access * operations on a
ID: 3617622 • Letter: #
Question
/**
* A stack provides last-in-first-out behavior. All access
* operations on a stack are done at its<code>top</code>.
*/
public interface Stack<E> {
/**
* Determine if the stack is empty.
* @return <code>true</code> if the stackis empty,
* otherwise return false
*/
public boolean isEmpty();
/**
* Return the top element of the stack without removingit.
* This operation does not modify the stack.
* @return topmost element of the stack
* @throws EmptyStackException if the stack isempty
*/
public E peek();
/**
* Pop the top element from the stack and returnit.
* @return topmost element of the stack
* @throws EmptyStackException if the stack isempty
*/
public E pop();
/**
* Push <code>element</code> on top of thestack.
* @param element the element to be pushed on thestack.
*/
public void push( E element );
/**
* Return the number of elements currently stored inthe stack.
* @return topmost element of the stack
*/
public int size();
}