Using the class java.util.Stack, define a class OurStack that implements the interface StackInterface, as given in Listing.
LISTING 1 An interface for the ADT stack
public interface StackInterface{ /** Adds a new entry to the top of this stack. @param newEntry an object to be added to the stack */ public void push(T newEntry); /** Removes and returns this stack’s top entry. @return either the object at the top of the stack or, if the stack is empty before the operation, null */ public T pop(); /** Retrieves this stack’s top entry. @return either the object at the top of the stack or null if the stack is empty */ public T peek(); /** Detects whether this stack is empty. @return true if the stack is empty */ public boolean isEmpty(); /** Removes all entries from this stack */ public void clear();} // end StackInterface
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.