listing stacks and queues continued else /if smallerbreak/done shifting /end for quearray[ + item/insert it nitems++/end else (nitems /end insert(//public long remove(/remove minimum item return quearray[--nitems]//public long peekmin(/peek at minimum item return quearray[nitems- ]//public boolean isempty(/true if queue is empty return (nitems== )//public boolean isfull(/true if queue is full return (nitems =maxsize)///end class priorityq ///////////////////////////////////////////////////////////////class priorityqapp public static void main(string[argsthrows ioexception priorityq thepq new priorityq( )thepq insert( )thepq insert( )thepq insert( )thepq insert( )thepq insert( )while!thepq isempty(long item thepq remove()system out print(item ")/ /end while system out println("")/end main(///end class priorityqapp