size( ( pop( ( push( ( pop( ( pop( ( stack interface in java because of its importancethe stack data structure is included as "built-inclass in the java util package of java class java util stack is data structure that stores generic java objects and includesamong othersthe methods push()pop()peek((equivalent to top())size()and empty((equivalent to isempty()methods pop(and peek(throw exception emptystackexception if they are called on an empty stack while it is convenient to just use the built-in class java util stackit is instructive to learn how to design and implement stack "from scratch implementing an abstract data type in java involves two steps the first step is the definition of java application programming interface (api)or simply interfacewhich describes the names of the methods that the adt supports and how they are to be declared and used