operations on a stack

 

operations on a stack

1. To insert an item: 
   we “push” it into the stack - push()

2. To delete an item:
   we “pop” it - pop()

3. To get the item value at the top od the stack:
   we “peek” for it - peek()

4. To return true if and only the stack is empty:
   we use the Boolean method isEmpty()

5. We can create an empty stack

6. Referred to as LIFO (last in, first out)