class Stack<E> extends
class Vector<E> with the algorithm "last in - first out":
Each new element is placed at the very top.
The first element is the one at the very top.
Class
Stack extends class
Vector with five functions that allow a vector to be treated as a stack:
Java
push(E item) // Add a new element and the element is placed at the very top
E pop() // Pull out the element, take the element that is at the very top and delete it
E peek() // Look at the element that is at the very top, the element is not deleted
boolean empty() // checks if this stack is empty
int search(Object o) // Look for the item, the position is returned starting with 1