/take item from top of stack return thelist deletefirst()//public boolean isempty(/true if stack is empty return thelist isempty()//public void displaystack(system out print("stack (top-->bottom)")thelist displaylist()///end class linkstack ///////////////////////////////////////////////////////////////class linkstackapp public static void main(string[argsthrows ioexception linkstack thestack new linkstack()/make stack thestack push( )thestack push( )/push items thestack displaystack()/display stack thestack push( )thestack push( )/push items thestack displaystack()/display stack thestack pop()thestack pop()/pop items thestack displaystack()/end main(/display stack /end class linkstackapp the main(routine creates stack objectpushes two items on itdisplays the stackpushes two more itemsand displays it again finally it pops two items and displays the stack again here' the output