The following example shows how to use Stack.peek API and related operations.
Stack provides the following APIs,
public synchronized E peek()
- Returns the object at top of stack without remove it from stack.
public E push(E paramE)
- Pushes an element onto the top of stack.
public synchronized E pop()
- Removes the element at top of stack.