instancethe error condition that occurs when calling method pop(or top(on an empty stack is signaled by throwing an exception of type emptystackexceptionwhich is defined in code fragment code fragment exception thrown by methods pop(and top(of the stack interface when called on an empty stack complete java interface for the stack adt is given in code fragment note that this interface is very general since it specifies that elements of any given class (and its subclassescan be inserted into the stack it achieves this generality by using the concept of generics (section for given adt to be of any usewe need to provide concrete class that implements the methods of the interface associated with that adt we give simple implementation of the stack interface in the following subsection code fragment interface stack documented with comments in javadoc style (section note also the use of the generic parameterized typeewhich implies that stack can contain elements of any specified class