stack.pop (java in) return the top element,
It can be used
Stack<Integer>stack=new Stack<Integer>();
int top=stack.pop()
And c ++'s stack.pop () pop the top element, does not return a value.
Stack <int> myStack int Top = myStack.pop () with this is not acceptable. c ++ is int top = myStack.top ();