Stack inherits from Vector, and the underlying implementation is an array.
Stack method
Java has only one constructor without parameters.
Excluding methods inherited from Vector, Stack has five other methods, including:
boolean, empty (), test whether the stack is empty.
E, peek (), view the object at the top of the stack, but do not remove it from the stack.
E. pop (), remove the object at the top of the stack, and return the object as the value of this function.
E, push (E item), push the item onto the top of the stack.
int, search (Object o), return the position of the object on the stack, the index of the top element of the stack is 1. If the object does not exist on the stack, -1 is returned.