pop()remove from the stack and return the top element on the stackan error occurs if the stack is empty additionallylet us also define the following methodssize()return the number of elements in the stack isempty()return boolean indicating if the stack is empty top()return the top element in the stackwithout removing itan error occurs if the stack is empty example the following table shows series of stack operations and their effects on an initially empty stack of integers operation output stack contents push( ( push( ( pop( ( push( ( pop(